In my case, the integration was correctly set in the docker-app, WSL2 was correctly the default wsl, and I wasn't able to solve unregistering the wsl docker instance and restarting the docker service like mentioned in other answers.
After some time, I noticed that the command docker-compose
successfully worked. The issue was limited to the docker
command.
I looked for all docker commands in the directory usr/bin
, that is the path where docker-compose
is located (which docker-compose
), so runnining ls -l /usr/bin | grep docker
, I found
drwxrwxrwx 1 root root 48 Nov 29 10:59 docker
lrwxrwxrwx 1 root root 56 Nov 29 10:59 docker-compose -> /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker-compose*
lrwxrwxrwx 1 root root 59 Nov 29 10:59 docker-compose-v1 -> /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker-compose-v1*
lrwxrwxrwx 1 root root 71 Nov 29 10:59 docker-credential-desktop.exe -> /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker-credential-desktop.exe*
lrwxrwxrwx 1 root root 50 Nov 29 10:59 hub-tool -> /mnt/wsl/docker-desktop/cli-tools/usr/bin/hub-tool*
For some weird reason, docker wasn't a symbolic link but a directory.
I solved removing the directory and re-creating manually the symbolic link:
rm -rf /usr/bin/docker
sudo ln -s /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker /usr/bin/docker