Change Docker images location in Windows

One of the things I wish I knew before using Docker for Windows, is that configuring where images and containers are stored is not really straight-forward. Here how to change the default location from C:\ProgramData\Docker to whatever drive and folder you like. In my case I like to keep the same structure, but in D:, like this: D:\ProgramData\Docker

To change the location via UI, from your system tray, right click on the docker (the whale) icon:

Note, this assumes that you are using Docker from the “stable” channel. With “edge” I think you may not have the “Daemon” option as in the screenshot, then keep reading to change the file manually.

Then from the menu, select “Settings…” > “Daemon” > click on the “Advanced” switch > Add (notice that every backslash is escaped with another backslash), feel free to change the location to your desired one:

"graph": "D:\\ProgramData\\Docker"

The result should look like this:

Click “Apply”, docker will restart and you are set.

Alternatively you can edit the C:\ProgramData\Docker\config\daemon.json file and add the “graph” property with your favorite text editor, then save and restart the docker service.

To restart docker: right click on the docker icon > at the bottom click on “Restart”.

Unluckily, the old images will stay in the old location and it’s up to you to manually delete them after restarting docker. They are inside C:\ProgramData\Docker\windowsfilter

I’m not sure if you can simply move them to the new location. I didn’t bother. I tried to copy the files from windowsfilter but got some errors and saw that some links were not copied correctly, so I gave up and simply built my docker files to generate a new, clean images and containers from scratch.

One thought on “Change Docker images location in Windows

Leave a Reply

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