I forgot the reason, but suddenly the docker command stopped working. Of course, docker-compose is the same.
Error message
ERROR: dial unix /mnt/wsl/docker-desktop/shared-sockets/guest-services/docker.sock: connect: no such file or directory
I think that the path part differs depending on the person, but I got this error.
There is a symlink on wsl called /var/run/docker.sock
, which points to a socket in the wsl distribution called docker-desktop, which somehow disappeared. I will.
Restarting Docker or restarting wsl didn't help.
By the way, I could use the docker command from Power Shell. It seems that the connection from wsl to the docker daemon is just broken.
Reference: ubuntu running under WSL2 not seeing Docker daemon at unix: ///var/run/docker.sock # 5096
When I started Docker Desktop with wsl integration enabled, I created symbolic links for various related files such as the socket in wsl, but it did not heal even if I restarted because they remained halfway. It seems that. So, delete all docker related files.
sudo find /usr -name "*docker*" -type l -exec rm {} +
sudo find /usr -name "*Docker*" -type l -exec rm {} +
sudo find /usr -name "*kube*" -type l -exec rm {} +
sudo rm /usr/share/doc/docker-ce-cli/changelog.Debian.gz
sudo rm /var/run/docker*
After executing the above command with wsl, restarting docker fixed it. It was good.
Recommended Posts