Docker Desktop WSL2 modify image storage location
docker desktop creates two wsl subsystems during installation, use the command wsl -l -v --all
to view:
Note that if it is version 1, do not modify the storage location of the image, as docker will fail to open due to an exception!
docker-desktop
It is for storing programs and docker-desktop-data
images. These two wsl subsystems are placed on the system disk by default.
Let's start moving!
Delete all image/container/wsl/hyperv
data:
Export the wsl subsystem image:
wsl --export docker-desktop docker-desktop.tar
wsl --export docker-desktop-data docker-desktop-data.tar
Remove the existing wsl subsystem:
wsl --unregister docker-desktop
wsl --unregister docker-desktop-data
Recreate the wsl subsystem:
wsl --import docker-desktop D:\CStools\DockerImg\desktop docker-desktop.tar
wsl --import docker-desktop-data D:\CStools\DockerImg\desktop-data docker-desktop-data.tar
Then re-run docker desktop