Closed ad-on-is closed 4 years ago
I got docker to work (used docker edge desktop and connected/disconnected it a few times in the resource settings 🤷 ), but then i have problems with user id's passing through to the docker image... Maybe the docker WSL2 impl does not like systemd?
I have tried using docker in Ubuntu WSL2 with the systemd hack enabled as well and indeed it does not work. I get the following error message:
The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.
See https://docs.docker.com/docker-for-windows/wsl/ for details.
That's something we can look into...
The systemd namespace cannot see most files in the docker-desktop WSL 2 container. It can only list the top-most directories.
I'm not sure how access is controlled but it could be UNIX file permissions, mounts, or a linux security module.
To reproduce, comment out the start-systemd-namespace
line near the top of your /etc/bash.bashrc
to load into a working WSL 2 shell:
stealthybox:~$ ls /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker
/mnt/wsl/docker-desktop/cli-tools/usr/bin/docker
stealthybox:~$ find /mnt/wsl/docker-desktop/ | wc -l
239
stealthybox:~$ /usr/sbin/start-systemd-namespace
Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.19.104-microsoft-standard x86_64)
Last login: Wed Jun 17 12:35:21 MDT 2020 on pts/0
stealthybox:~$ ls /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker
ls: cannot access '/mnt/wsl/docker-desktop/cli-tools/usr/bin/docker': No such file or directory
stealthybox:~$ find /mnt/wsl/docker-desktop/ | wc -l
6
stealthybox:~$ exit
logout
stealthybox:~$ ls /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker
/mnt/wsl/docker-desktop/cli-tools/usr/bin/docker
stealthybox:~$ find /mnt/wsl/docker-desktop/ | wc -l
239
I found that https://github.com/diddledan/ubuntu-wsl2-systemd-script works expected
I found that https://github.com/diddledan/ubuntu-wsl2-systemd-script works expected
Hi @ad-on-is It seems Daniel's repo stays the same with main repo, and in my test docker still not working with code in Daniel's repo. Did you edit some parts to make it work?
I found that https://github.com/diddledan/ubuntu-wsl2-systemd-script works expected
Hi @ad-on-is It seems Daniel's repo stays the same with main repo, and in my test docker still not working with code in Daniel's repo. Did you edit some parts to make it work?
No, I did not, I just ran the script and forced the re-installation.
No, I did not, I just ran the script and forced the re-installation.
Thank you for your reply! It seems my environment got some problems. I've already changed from docker to containerd, and that works well.
I couldnt get docker running either
I've run the script and
snap
works, but docker does not. I'm running WSL 2 with Ubuntu 20.04 and I'm using Windows terminal.When I do
docker ps
, I get the errordocker command not found
Although, when I open VSCode Remote-Extension and type
docker ps
in the VSCode terminal, Docker works there.Inspecting
ps -ef
on both, VSCode and Terminal, gives me:VSCode:
root 1 0 0 13:16 ? 00:00:00 /init
Terminal:root 1 0 0 13:16 ? 00:00:00 /lib/systemd/systemd --system-unit=basic.target
Both env-variables are set
Is this scenario even supposed to work with
systemd
enabled?Cheers,