'Docker Desktop with WSL2 Unable to Start

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:

  • Reinstalling Docker Desktop.
  • Reinstalling Docker in WSL.
  • Creating the .sock file manually.

Versions

  • Docker Desktop version: 2.3.0.3 (45519)
  • WSL2 with Ubuntu 18.04
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?



Solution 1:[1]

After trying multiple things, repair of Ubuntu, a reset of Ubunutu. What worked for me was to:

  • uninstall Ubuntu (after backing up my files)
  • uninstall Docker Desktop
  • reinstall the latest version of Ubuntu 20.20
  • reinstall Docker Desktop

Solution 2:[2]

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.

Solution 3:[3]

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

Solution 4:[4]

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.

Solution 5:[5]

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

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Roma
Solution 3
Solution 4 Gryffe
Solution 5