I want to transfer a Docker image from my Windows10 PC to another one, Fedora, using rsync. I can’t use WSL, I need WSL2 as the compiler says:
ubu@DESKTOP-QL4RO3V:/mnt/c/Windows/system32$ docker images
The command 'docker' could not be found in this WSL 1 distro.
We recommend to convert this distro to WSL 2 and activate
the WSL integration in Docker Desktop settings.
For details about using Docker Desktop with WSL 2, visit:
https://docs.docker.com/go/wsl2/
But I think that as I have Docker desktop it is using WSL2:
But I don’t know how to run the wsl2 Docker is using for my own.
PS C:Usersantoi> wsl -l -v
NAME STATE VERSION
* Ubuntu Running 1
docker-desktop-data Running 2
docker-desktop Running 2
2
Answers
Docker Desktop images, containers, and volumes are stored in the special
docker-desktop-data
. As noted in this Super User question and my answer there,docker-desktop-data
is not bootable (by design).If you really had to get to the filesystem, I’ve documented a way to do so there. But in general, you should not need to do this.
Instead, use the normal
docker
commands (from WSL2, PowerShell, or CMD) to save the image to atar
file as documented in this answer:Then transfer the file using
rsync
or other means, and on the destination machine, import it via:Again, that’s from WSL2, PowerShell, or CMD. But in your case, the Ubuntu instance is WSL1. That won’t work for Docker. You’ll need to convert it to WSL2.
Just in case, I always recommend backing up your instance before converting it. From PowerShell:
Then, once you have the backup:
After conversion, you shouldn’t see that error when running
docker
in Ubuntu.Side note — Docker Desktop "injects" the
docker
command into any WSL2 instance that you set in the "WSL Integration" tab in Settings. This should default to your "default" WSL2 instance, which (from your screenshot) is Ubuntu. The "real"docker
command is insidedocker-desktop
, but it’s linked into Ubuntu for you.So by default, you should have all
docker
functionality directly in yourUbuntu
instance. Neitherdocker-desktop
nordocker-desktop-data
are designed to be used directly by the end-user.You can access docker desktop WSL using the following command