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)
- Right-click on docker icon on desktop tray
- Click on Settings
3 Click on Resources from the left-hand menu then under the Disk Image location click on browse and change the location
- 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,
- quit docker desktop
- open/edit configuration file "C:\ProgramData\Docker\config\daemon.json"
- add setting "data-root": "D:\Virtual Machines\Docker"
- now start docker desktop
- run the command "docker info" to see the setting "Docker Root Dir: D:\Virtual Machines\Docker"
- pull docker images e.g.: docker pull mongo
- you can find the downloaded images in folder "D:\Virtual Machines\Docker\windowsfilter"