WSL: Docker daemon fails with following output
This bug-tracker is monitored by developers and other technical types. We like detail! So please use this form and tell us, concisely but precisely, what’s up. Please fill out ALL THE FIELDS!
If you have a feature request, please post to the UserVoice. If you’re reporting a BSOD, don’t post here! Instead, e-mail “secure@microsoft.com”, and if possible attach the minidump from "C:\Windows\minidump".
-
Your Windows build number: (Type
verat a Windows Command Prompt) -
What you’re doing and what’s happening: (Copy&paste specific commands and their output, or include screen shots)
-
What’s wrong / what should be happening instead:
-
Strace of the failing command, if applicable: (If
<cmd>is failing, then runstrace -o strace.txt -ff <cmd>, and post the strace.txt output here)
See our contributing instructions for assistance.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 15
- Comments: 91 (1 by maintainers)
Thanks for starting this thread. WSL PM here. As mentioned in the above comment, we have improved Docker support in recent builds of WSL. Most (if not all) versions of docker-ce work with WSL. We’re working on a large set of changes for WSL currently. As part of those changes, we are looking at adding native Docker support in WSL. I will add to this thread and other issues on Docker support when I have additional updates to share
I’m glad to say Docker daemon finally runs on WSL. I’m testing on build 17134.
The most important part is dockerd will only run on an elevated console (run as Admin) and cgroup should be always mounted before running the docker daemon.
The steps to install docker on Ubuntu Xenial are:
And every time you need to run the daemon, always on an elevated ubuntu.exe:
After that I tried these and did work:
It’s important to note that docker version in Xenial repositories is moby 1.13.1 which would be docker-ce 17.02. The last docker-ce version that works right now on build 17134 is 17.09.0. Anything after that fails on extracting the docker images.
Thanks to @targat1982’s post on reddit
That’s great news!
Unfortunately,
docker-composestill doesn’t work. I’m getting :There is a problem with
iptableswhich is not fully supported via WSL yet.Please upvote here: https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/32025199-support-iptables
Microsoft Windows [Version 10.0.15063]
Within the Bash on Ubuntu on Windows environment I successfuly installed docker.io with apt.
Subsequently I try to activate a docker container following https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/udacity
Thereafter I get bash telling me the docker daemon is not running. Trying to run dockerd (the daemon) result in the following output:
on clean ubuntu 18.04 just run these commands within a privileged bash:
wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_17.09.0~ce-0~ubuntu_amd64.deb -P /tmp/sudo dpkg -i /tmp/docker-ce_17.09.0~ce-0~ubuntu_amd64.debsudo apt -y -f installsudo usermod -aG docker $USERsudo apt -y install cgroupfs-mountsudo cgroupfs-mountsudo service docker startdocker run --network host hello-worldseeing the exact same issue as @HanJoHibender, I know it’s not simple, but having docker run like that on windows, is a game changer. it would be amazing. (I don’t have the Pro version on my home computer, and the vm based docker is a pain, and slow)
Just highlighting this note. I have missed it initially. Ensure your WSL terminal is running on elevated console
+1
Are there any plans to add support for docker to wsl?
Here’s my information if it can be any help.
ver-Microsoft Windows [Version 10.0.15063]strace -o strace.txt -ff service docker start- stacktace/var/log/docker.logEven better, you should set this parameter in the configuration file
/etc/docker/daemon.jsonlike this:No more
docker-composenetworking problem 😃Yes. I ended up adding an SSD to my pc and installing Linux on it. ¯_(ツ)_/¯
I’ve been able to make it work by changing the sequence to:
In my own installation, it works everything, including commands without “–network host” option.
Hope this helps.
@onomatopellan Thanks for your help! My issue is now solved!
I got this error :
I tried following this : https://github.com/docker/for-linux/issues/123#issuecomment-346546953 but when I enter the commands using
sudoI got this error :RTNETLINK answers: Permission deniedThe solution was to run the
sudo service docker startinside a bash terminal elevated as admin (windows side)! 👍EDIT : Too bad my next step was to use docker-compose! 😢 I hit this exact problem : https://github.com/Microsoft/WSL/issues/2291#issuecomment-396570242
@six7 you can try to run Docker daemon with parameter
--iptables=false.This is amazing! The absence of a native Linux docker is the only thing stopping many of us from developing on Windows.
Please also consider supporting docker-compose, which requires iptables from what I read.
perfect,it has sovled the problem that starting docker service with error bellow:
@WSLUser Docker for Windows requires a HyperV VM to run the container and in enterprise environment they generally disable running VMs because of security. So ideally if we can run Docker inside WSL without and need for VM that would be much better.
Hey guys,
thank you for this thread! I’m glad I’m not alone in this! Below my experience so far.
I’m running Windows 10 Pro Version 1903 Build 18362:
I perfomed a reset of Ubuntu WLS with the following steps:
Right-click on Ubuntu 18.04 LTS (WLS) icon > More > App Settings > ResetThen I launched Ubuntu WLS and typed these commands as suggested:
When I type the last one, I get the following “OK” output:
But then running “
docker ps” returns the following error:Running Ubuntu WLS as Administrator doesn’t change anything.
If I close Ubuntu WLS and open it again, the error is the one we are discussing in this thread:
Any other suggestion to make docker running in Ubuntu WLS for Windows 10, and get rid of Docker Desktop (which it’s a pain when handling data volumes due of permission issues etc)?
We installed Docker Desktop for Windows on my Windows 10 w/ WSL Ubuntu 1804.2019 and still receive the error:
$ docker run --network host hello-world docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See ‘docker run --help’.
@duke-cliff Were you able to get this working with Windows 10 1909? I followed the same steps + disabling iptables, but I end up with:
@Knedox’s solution appears to work (for me) up to 18.06.1, but not on anything more recent.
However it appears only to work with networking in ‘host’ mode. Using ‘bridge’ mode (which is the default) gives me an error
failed to add interface veth... to sandbox: failed to get link by name. So back to square one unless your containers don’t need to access the outside world AFAICS?Any news about docker-compose? Is it working on latest builds?
@tara-raj is there any rough timeline for this that you could share? I would like to know whether we are talking about weeks, months or years from now:)
Thanks @onomatopellan . Could you please edit your post, making the part
The most important part is dockerd will only run on an elevated console (run as Admin)as bold, or any other way that can be more eye-catchingthanks
@jgoux read carefully the comment https://github.com/Microsoft/WSL/issues/2291#issuecomment-383698720 The last docker-ce version that works right now on WSL is 17.09.0
Hi @onomatopellan, I’m really looking forward to the feature update in September. For now, I followed the install docs and installed that specific docker-ce version:
You mentioned this earlier:
I get an error when I run it:
I’m a little confused what that means, but I’m googling…
@zz80 As I said earlier in this thread.
Install docker-ce 17.09.0 OR Install latest Windows Insider build OR wait for next feature Update in September.
Build 17723 fixes the high CPU usage problem I had with latest Docker-ce probably because of #3276. Now every docker-ce version out there runs well on WSL and I’d even say in a more stable manner.
Systemd is PID1. Right now WSL uses a closed-source custom init due to that.
@stevefan1999 Are you on build 17134? That problem was due non supported MS_SLAVE flag on mount. It was fixed in build 17666
Running docker from Bionic (docker-ce 17.12.1) on latest insider builds works but containerd-shim shows high CPU usage on idle. Probably some syscall that was stubbed but not implemented yet.
The version of docker you’re using is obsolete. It’s version 1.something. The current version is 17.something. I’m having a problem with ivoke-rc.d though.