Reputation: 16751
All of a sudden my working Docker and WSL2 stopped working. I now get the following:
$ docker ps
Error response from daemon: dial unix /mnt/wsl/docker-desktop/shared-sockets/guest-services/docker.sock: connect: no such file or directory
Note: Docker is working and available via Windows.
I've tried the following, without any luck:
Versions
PS C:\Users\ms> wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 2
docker-desktop-data Running 2
docker-desktop Running 2
Any suggestions?
Upvotes: 6
Views: 30255
Reputation: 19
I've just had this problem in June 2024, here's what I did:
Make sure you have "Use the WSL 2 based engine" checked. AFAIK, this used to be the only checkbox/config. But... not anymore!
This is listed under "Enable integration with additional distros", but it only lists my default here!
For me, both of these were not set and it failed to mount my distro, just like the OP. Now everything is working.
Perhaps a reinstall enables these by default.
Upvotes: 0
Reputation: 1
If you use Windows, try these two commands in cmd:
sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth
After these two commands restart your computer.
Upvotes: -2
Reputation: 41
Try turning off all firewalls on Windows, Then quit docker Desktop and open it again
or
open powershell and run New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
, from: https://visualgdb.com/documentation/wsl2/
or
Upvotes: 0
Reputation: 411
I found (in powershell) wsl --list --verbose
docker-desktop-data stopped
The reason was that docker-desktop decided to use windows containers. I don't know why.
Upvotes: -1
Reputation: 1397
No need to install docker desktop, it only generates problems and makes things slower in windows. If you install Docker this way you will never ever again run into that problem:
# INSTALL DOCKER PACKAGE
sudo -E apt update && sudo apt upgrade -y
sudo -E apt-get -qq install docker.io -y
# DOCKER DAEMON STARTUP (Substitute .bashrc for .zshrc or any other shell you use)
rcfile=~/.bashrc
echo '# Start Docker daemon automatically when logging in if not running.' >> $rcfile
echo 'RUNNING=`ps aux | grep dockerd | grep -v grep`' >> $rcfile
echo 'if [ -z "$RUNNING" ]; then' >> $rcfile
echo ' sudo dockerd > /dev/null 2>&1 &' >> $rcfile
echo ' disown' >> $rcfile
echo 'fi' >> $rcfile
# ENABLE CURRENT USER AS SUDO FOR DOCKER
echo $USER' ALL=(ALL) NOPASSWD: /usr/bin/dockerd' | sudo EDITOR='tee -a' visudo
sudo usermod -aG docker $USER
# REBOOT VM MACHINE
wsl.exe --shutdown
After installation ends, open a new Ubuntu terminal and it will be ready to rock from now on. You can run any docker image such as:
docker run hello-world
or
docker run -it ubuntu
Upvotes: 12
Reputation: 16751
After trying multiple things, repair of Ubuntu, a reset of Ubunutu. What worked for me was to:
Upvotes: 0
Reputation: 673
I know this may sounds REALLY dumb but have you restarted your computer? I had a similar issue and when I restarted my computer, it worked.
Upvotes: 1