How to Change Docker Storage \ Data Folder on Windows Server 2016

In this blog post, I will show you how I change the storage location of Docker and windows Containers on Windows Server 2016.

My Container Host Is running Docker Enterprise Edition version 17.06.2.ee.6 on Windows Server 2016.

Docker Configuration File

By default, Docker stores Images and other configuration files In the location below:

C:\ProgramData\Docker

Which also mean that Images, volumes, etc will be stored In the same location.

To change the storage location I’ll need to create a configuration file called Daemon.json and specify the new storage location.

By default, the file doesn’t exist and we need to create it under the path below:

'C:\ProgramData\Docker\config\daemon.json'

As you can see I created the file

Before, making any changes I must stop the Docker service

Add Configuration

Now, that the Docker service Is stopped, I’ll add the code below that will change my storage location for docker.

In my case, I created a new folder on my C drive.

{
"data-root": "c:\\dockerdata"
}

After saving the configuration file, I’ll restart the docker service using the code below:

Restart-Service Docker

After restart, docker will move the configuration files and new Images will be saved In the new location

Below, I’ll download a new Image

Docker pull microsoft/dotnet

And as you can see below, content will be saved to the new location

Leave a Reply

Your email address will not be published. Required fields are marked *