Change Docker native images location on Windows 10 Pro

Solution 1:

Docker Desktop now can use WSL 2 Backend, in this mode, you need to move the wsl data.

In my case(Windows10 with Docker Desktop) none of the above solutions did help me. I found the solution , run this commands . This command change docker directory to drive D: (don't forget to quit docker desktop)

wsl --shutdown
wsl --export docker-desktop-data docker-desktop-data.tar
wsl --unregister docker-desktop-data
wsl --import docker-desktop-data D:\docker-new-repo\ docker-desktop-data.tar --version 2

And now you can delete .tar file

there is a very good blog post explaining everything: https://dev.to/kimcuonthenet/move-docker-desktop-data-distro-out-of-system-drive-4cg2

Solution 2:

Docker Version : 2.2.0.3 (42716)

  1. Right-click on docker icon on desktop tray

enter image description here

  1. Click on Settings

enter image description here

3 Click on Resources from the left-hand menu then under the Disk Image location click on browse and change the location

  1. Click on apply and restart

Solution 3:

I found a solution here

Docker native, on Windows, runs in a Hyper-V virtual machine.

Move existing docker VM

I have to move the VM used by docker to the desired location. I did this using the GUI of Hyper-V manager. The VM for docker is called MobyLinuxVM.

  • Right-click MobyLinuxVM
  • Select Move
  • Select desired location

Set location of futures Hyper-V VMs

And to be sure futures VMs of Hyper-V will be stored on my secondary drive, I followed those instructions

In a powershell terminal (destination folders must exist)

SET-VMHOST –computername <computer> –virtualharddiskpath 'D:\Hyper-V_Virtual-Hard_Disks' SET-VMHOST –computername <computer> –virtualmachinepath 'D:\Hyper-V_VMs'

Solution 4:

In 2020 to "Change Docker native images location on Windows 10 Pro" is,

  1. quit docker desktop
  2. open/edit configuration file "C:\ProgramData\Docker\config\daemon.json"
  3. add setting "data-root": "D:\Virtual Machines\Docker"
  4. now start docker desktop
  5. run the command "docker info" to see the setting "Docker Root Dir: D:\Virtual Machines\Docker"
  6. pull docker images e.g.: docker pull mongo
  7. you can find the downloaded images in folder "D:\Virtual Machines\Docker\windowsfilter"