Move docker to another disk

create symbolic link

How to move docker into another disk (secondary disk)?

I’ve got a 120gb SSD and as you can imagine, besides the operating system, not many other apps fit on it. I was playing around with docker, and easily enough, my C: drive got full. I googled around how to install docker on my D: drive, found a couple of possible solutions, but they weren’t really straightforward, and I wasn’t even able to make them work. So that’s when I had the following idea – why not move the heavy folders from docker into the D: drive and create a symbolic link? And that’s exactly what I did! Keep in mind that this technique probably works with any program, meaning you’ll be able to move any program into another disk. Here are the necessary steps:

  1. Close docker (docker cannot be running);
  2. CUT the following folder “C:\ProgramData\DockerDesktop”;
  3. Create the following folder “D:\ProgramData”;
  4. Paste the content from step 2) into “D:\ProgramData”. This might take a couple of minutes, but after it’s done, you should have the following folder “C:\ProgramData\DockerDesktop” with the contents that you previously had on step 1);
  5. Open the command Prompt as Administrator;
  6. Run the following mklink /D “C:\ProgramData\DockerDesktop” “D:\ProgramData\DockerDesktop”
  7. Start docker again.

And it’s done. The mklink command will create a pointer to the folder in your secondary disk, so Docker will not notice any change. As far as docker is concerned, it continues to look for the data in “C:\ProgramData\DockerDesktop”.

This solved my problem, hopefully this helps you as well, cheers!