I want to bring the docker image and vhdx where the container is saved to any folder on the D drive instead of C. Basically, I followed the procedure linked to as a reference.
chgdockerdir_failed.ps
wsl --import docker-desktop D:\Docker\docker-desktop docker-desktop.tar
After running the above, the import destination is not vhdx, A group of folders with a directory structure like Linux is created. Even in that state, Docker Desktop will start, and docker -v will return the version information. The docker run command does not start and the following error occurs.
chgdockerdir_failed2.ps
docker run -d -p 80:80 docker/getting-started
docker: Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified.
chgdockerdir_failed2.ps
wsl --import docker-desktop D:\Docker\docker-desktop docker-desktop.tar --version 2
With this, I was able to import with vhdx successfully. If not specified, may it be version1? There seems to be a command that can set wsl defaults, so Isn't there any problem if it is set in advance?
wsl --set-default-version 2 It seems that it is OK even if you do not specify the version at the time of import if you set it in advance with.
By the way, if neither one nor the other goes Docker Desktop Troubleshooting Press "Clean / Purge data" to restore.
Implemented from Powershell below
chgdockerdir.ps
#Stop docker
#Set the default wsl version to 2
wsl --set-default-version 2
#Shut down the distribution once
wsl --shutdown
wsl -l -v
# NAME STATE VERSION
#* docker-desktop Stopped 2
# docker-desktop-data Stopped 2
#Export the current vhxd in tar format
wsl --export docker-desktop docker-desktop.tar
wsl --export docker-desktop-data docker-desktop-data.tar
wsl --unregister docker-desktop
#Unregistered...
wsl --unregister docker-desktop-data
#Unregistered...
#Load the tar you just exported
wsl --import docker-desktop D:\Docker\docker-desktop docker-desktop.tar
wsl --import docker-desktop-data D:\Docker\docker-desktop-data docker-desktop-data.tar
I want to change the storage location of the WSL2 Docker image container (I want to move the WSL2 vhdx file) How to move Docker Desktop disk space from C drive to another drive Importing and exporting "WSL" distributions is so easy!
Recommended Posts