How can I change the location of docker images when using Docker Desktop on WSL2 with Windows 10 Home? How can I change the location of docker images when using Docker Desktop on WSL2 with Windows 10 Home? docker docker

How can I change the location of docker images when using Docker Desktop on WSL2 with Windows 10 Home?


The WSL 2 docker-desktop-data vm disk image would normally reside in:%USERPROFILE%\AppData\Local\Docker\wsl\data\ext4.vhdx

Follow the following to relocate it to other drive/directory, with all existing docker data preserved (tested against Docker Desktop 2.3.0.4 (46911), and continued to work after updating the 3.1.0 (51484)):

First, shut down your docker desktop by right click on the Docker Desktop icon and select Quit Docker Desktop

Then, open your command prompt:

wsl --list -v

You should be able to see, make sure the STATE for both is Stopped.(wsl --shutdown)

  NAME                   STATE           VERSION* docker-desktop         Stopped         2  docker-desktop-data    Stopped         2

Export docker-desktop-data into a file

wsl --export docker-desktop-data "D:\Docker\wsl\data\docker-desktop-data.tar"

Unregister docker-desktop-data from wsl, note that after this, your ext4.vhdx file would automatically be removed (so back it up first if you have important existing image/container):

wsl --unregister docker-desktop-data

Import the docker-desktop-data back to wsl, but now the ext4.vhdx would reside in different drive/directory:

wsl --import docker-desktop-data "D:\Docker\wsl\data" "D:\Docker\wsl\data\docker-desktop-data.tar" --version 2

Start the Docker Desktop again and it should work

You may delete the D:\Docker\wsl\data\docker-desktop-data.tar file (NOT the ext4.vhdx file) if everything looks good for you after verifying


Edit: re-register docker-desktop would set the default docker-data to C drive now, so we should only unregister docker-data as the accepted answer.

You can do

 wsl --unregister docker-desktop-data wsl --import docker-desktop-data D:\wsl\docker-desktop-data "C:\Program Files\Docker\Docker\resources\wsl\wsl-data.tar" --version=2

The tar file is the file used to install, and before it is your new destination.

This always work while the move-wsl or lxrunoffline didn't work for me on fast rings. And sometimes you have to unistall/install docker first


  1. Stop Docker Desktop
  2. Relocate Docker folder from C:\Users\xxx\AppData\Local\Docker to new path
  3. Make sure C:\Users\xxx\AppData\Local\Docker is no longer there
  4. Open a cmd in administrator mode
  5. Run the following command that will create a symbolic link in the cmd window with the appropriate from and to path
    mklink /j "C:\Users\xxx\AppData\Local\Docker" "path to where you relocated your docker folder"
  1. Restart Docker Desktop