Docker Desktop WSL2 modify image storage location

Docker Desktop WSL2 modify image storage location

docker desktop creates two wsl subsystems during installation, use the command wsl -l -v --allto 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!

insert image description here

docker-desktopIt is for storing programs and docker-desktop-dataimages. These two wsl subsystems are placed on the system disk by default.

Let's start moving!

Delete all image/container/wsl/hypervdata:

insert image description here

Export the wsl subsystem image:

wsl --export docker-desktop docker-desktop.tar
wsl --export docker-desktop-data docker-desktop-data.tar

insert image description here

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

Guess you like

Origin blog.csdn.net/Gherbirthday0916/article/details/130154040