Docker host on Windows, low disk space

I recently came into trouble with Docker on my Windows machine because it was using too much disk space. Docker uses a Mobilinux VM as a virtual Docker host, eventually this VM will grow in size. Also, your working Docker folder for downloading the images will grow as well.

You can not move these folders, because Docker doesn’t support this, yet.

However, you can copy the folder to another disk and create a symlink from the original location to the new one.

There are two folder that you need to consider moving:

  • C:\Users\Public\Documents\Hyper-V\Virtual hard disks
  • C:\ProgramData\Docker

The first folder will house the MobiLinux VM and the second will contain all the volumes, images, plugins, …

Step 1: Shut down Docker

Step 2: Copy the contents of these folders to another disk (E:\ for example)

Step 3: Rename the original folders (Virtual hard disks_old, Docker_old)

Step 4: Create symlinks

In order to create a symlink, open the folder in command line (run as administrator) and type the following:

cd C:\Users\Public\Documents\Hyper-V
mklink /D “Virtual hard disks” “E:\Virtual hard disks”
cd C:\ProgramData
mklink /D “Docker” “E:\Docker”

After that, start up Docker to verify that it still works. If it does, you can safely delete the original folders.

Your C: drive should now be >15GB lighter.