How to Change the Docker Drive from C

We are in the process of a new installation of Planning Analytics Workspace at a client. We don’t want the Planning Analytics Workspace (PAW) Docker containers to be on the same drive at the Operating System. This post explains how to change the default location for Docker containers – including the PAW containers – to a different hard disk that the C drive.

Steps to Change the Docker Drive from C

Assuming that you have successfully installed Docker and run Hello World, then all you need to do to change the drive docker lives on is the following:

  • Create a new folder called “Docker” at the root of your secondary drive, e.g. “E:\Docker”
  • Go to “C:\ProgramData\docker\config\” and create a new file called “daemon.json”. Make sure it is in the docker\config folder, not just the docker folder!
  • Here is a download of the file.
  • If you are creating it yourself, paste the following (noting the double backslash!):
{    
"data-root": "e:\\docker"
}
  • Make sure you change the drive that is referred to in the file to the drive you want to use (so if it should be drive D, rather than E, then make it “d:\\docker”!)
  • If you already have an existing daemon.json file in the config folder, just add the line to the file.
  • Restart the Docker service and this will repoint docker to the new drive as defined in the daemon file.
  • Note that if Docker does not start properly, check that you have a double backslash in the data-root directory

Test with Hello World

In an elevated Powershell window run the Hello World docker script. Paste:

docker pull hello-world

Then, assuming you are connected to the internet, it will run the script and unpack into the new location. Please check that these files are now located correctly.

You might also like