WSL: docker installation fails E: Can not write log(Is /dev/pts mounted?)

root@localhost:/mnt/c/apps/cmder# apt-get install docker
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  docker
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 0 B/12.2 kB of archives.
After this operation, 65.5 kB of additional disk space will be used.
E: Can not write log (Is /dev/pts mounted?) - openpty (2: No such file or directory)
Selecting previously unselected package docker.
(Reading database ... 24948 files and directories currently installed.)
Preparing to unpack .../docker_1.5-1_amd64.deb ...
Unpacking docker (1.5-1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up docker (1.5-1) ...
root@localhost:/mnt/c/apps/cmder# docker
The program 'docker' is currently not installed. You can install it by typing:
apt-get install docker
root@localhost:/mnt/c/apps/cmder#

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Reactions: 26
  • Comments: 50 (13 by maintainers)

Most upvoted comments

@aseering Great explanation. Without making any promises I can say that we know docker is an important and powerful too and definitely something we’re looking into.

For what it’s worth: A big piece of docker-engine actually lives inside the kernel itself. That’s why it keeps requiring newer kernels. (The docker-engine process doesn’t actually do a whole lot itself when running a container; its job is to tell the kernel what to do, the kernel does the real work.)

WSL is a clean-room kernel reimplementation. So it can’t, for both technical and legal reasons, simply take the kernel components of Docker and “make it work”. They would need to reverse-engineer years of ongoing kernel development and reimplement it. (Or take some other nontrivial approach.)

If I were a WSL dev (which I’m not), I would totally enjoy that project. But it would take me a huge amount of time, time that could be spent building many other big features.

I can confirm the issue from May posted by @yarmand is still the same as it is today.

$ docker -D info

Cannot connect to the Docker daemon. Is the docker daemon running on this host?
$ sudo docker daemon

can't create unix socket /var/run/docker.sock: listen unix /var/run/docker.sock: setsockopt: invalid argument
$ sudo strace docker daemon

...
setsockopt(4, SOL_SOCKET, SO_BROADCAST, [1], 4) = -1 EINVAL (Invalid argument)
close(4)                                = 0
...

Someone made the Docker work?

yeah, cgroups aren’t implemented to my knowledge.

Also, I don’t know if cgroupsv2 has been fully rolled out in the Linux kernel, and cgroupsv1 is basically dead. This video has some details on why, if you don’t want to sift through the LKML stuff:

https://www.youtube.com/watch?v=PzpG40WiEfM

Basically, the v1 hierarchies made no sense and lots of the controllers would fight against each other for resources (for example, you could give something a ton of memory priority but no disk i/o and it would break virtual memory, etc, or you could give a large amount of cpu with no memory, or you could give a large amount of disk i/o with low memory and you wouldnt have enough memory for buffers to write to disk efficiently or caching reads for efficinet access to frequently used resources), or sometimes didn’t do anything at all. The second version is a complete rethink and reimplementation that gets rid of a lot of the implementation showing through and also simplifies the hierarchies and prevents controllers working against each other.

Since WSL isn’t actually meant for in-production servers, the team might be able to use a simplified or stubbed-out version of cgroups, or maybe somehow cgroupsv2 maps well onto the existing NT kernel infrastructure. I guess we’ll see!

This is what I get trying to start dockerd manually:

:/mnt/c/www$ sudo dockerd
WARN[2018-04-02T14:46:43.056552600-07:00] Could not set daemon root propagation to shared, this is not generally critical but may cause some functionality to not work or fallback to less desirable behavior  dir=/var/lib/docker error="invalid argument"
INFO[2018-04-02T14:46:43.091924600-07:00] libcontainerd: started new docker-containerd process  pid=9993
INFO[0000] starting containerd                           module=containerd revision=cfd04396dc68220d1cecbe686a6cc3aa5ce3667c version=v1.0.2
INFO[0000] loading plugin "io.containerd.content.v1.content"...  module=containerd type=io.containerd.content.v1
INFO[0000] loading plugin "io.containerd.snapshotter.v1.btrfs"...  module=containerd type=io.containerd.snapshotter.v1
WARN[0000] failed to load plugin io.containerd.snapshotter.v1.btrfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module=containerd
INFO[0000] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  module=containerd type=io.containerd.snapshotter.v1
INFO[0000] loading plugin "io.containerd.metadata.v1.bolt"...  module=containerd type=io.containerd.metadata.v1
WARN[0000] could not use snapshotter btrfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module="containerd/io.containerd.metadata.v1.bolt"
INFO[0000] loading plugin "io.containerd.differ.v1.walking"...  module=containerd type=io.containerd.differ.v1
INFO[0000] loading plugin "io.containerd.gc.v1.scheduler"...  module=containerd type=io.containerd.gc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.containers"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.content"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.diff"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.events"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.healthcheck"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.images"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.leases"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.namespaces"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.snapshots"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.monitor.v1.cgroups"...  module=containerd type=io.containerd.monitor.v1
INFO[0000] loading plugin "io.containerd.runtime.v1.linux"...  module=containerd type=io.containerd.runtime.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.tasks"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.version"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.introspection"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] serving...                                    address="/var/run/docker/containerd/docker-containerd-debug.sock" module="containerd/debug"
INFO[0000] serving...                                    address="/var/run/docker/containerd/docker-containerd.sock" module="containerd/grpc"
INFO[0000] containerd successfully booted in 0.095300s   module=containerd
INFO[2018-04-02T14:46:43.410322300-07:00] Graph migration to content-addressability took 0.00 seconds
WARN[2018-04-02T14:46:43.410986500-07:00] Your kernel does not support cgroup memory limit
WARN[2018-04-02T14:46:43.411430700-07:00] Unable to find cpu cgroup in mounts
WARN[2018-04-02T14:46:43.433371200-07:00] Unable to find blkio cgroup in mounts
WARN[2018-04-02T14:46:43.433807500-07:00] Unable to find cpuset cgroup in mounts
WARN[2018-04-02T14:46:43.435181100-07:00] mountpoint for pids not found
Error starting daemon: Devices cgroup isn't mounted

@benhillis now i tried install docker-ce according to the official website documentation。 https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-from-a-package but run : docker run hello-world it still : docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

@itaysk - This issue is specifically about docker not installing, which as been fixed. There are other issues tracking various docker pieces not working.

@fpqc – I don’t know the full list offhand, but I know it also does a bunch of stuff with the kernel network layer. It creates virtual network devices (related to tap/tun devices, I think?, which as you’ve said are very low priority right now). It creates a virtual network bridge (same syscalls as brctl, as far as I know). It uses iptables for routing network traffic between containers.

WSL’s socket implementation is in general not robust enough yet. Docker can run over TCP today; but even in that scenario, which is in theory supported, Docker puts a fair bit of stress on the socket, especially when building new containers (it has a client/server model so sends all filesystem data over the network) and there are still bugs/deadlocks in WSL’s socket implementation ( #30 #575 ) that cause it to intermittently hang. And, of course, it prefers and defaults to AF_UNIX, which still needs more functionality as you mentioned.

It also does bind-mounts of both directories and files, I believe. Bind-mounts ought to be easy to implement, I think? But I don’t think they work yet.

WSL would have to implement the requirements for at least one of the storage backends – one of AUFS, OverlayFS, BtrFS’s snapshotting capabilities, or the whole DeviceMapper subsystem plus loopback devices and mount support for ext4, etc. I think there is a backend that mostly works on just a regular filesystem, but I believe it’s firmly labeled as not for production use / mostly just for debugging Docker – Docker uses copy-on-write semantics extensively; emulating that is expensive and a pain to get right.

Also, there’s “supports cgroups and namespaces” and then there’s “supports cgroups and namespaces” 😃 My understanding, which may be incorrect, is that systemd only really requires pretty basic support for both, at least to get it minimally working. Enumerating the available cgroups, setting some values, etc. Docker uses both cgroups and namespaces extensively; I would be surprised if it worked properly without relatively complete support for the network namespace; I don’t know offhand about other namespaces. Docker uses cgroups to impose various restrictions on the processes within a container; I don’t have a clear picture in my head of exactly how it uses cgroups, but my guess is that basic containers would mostly work with stubbed-out support there, but they would be somewhat flaky and wouldn’t support a bunch of Docker’s resource-limiting features without more complete support.

You’re right that Docker doesn’t require specific kernel patches. For perspective, though: In the US at least, Red Hat Enterprise Linux is the most popular enterprise Linux solution. And RHEL 6 (or its free counterpart CentOS 6) is the most common version in existing deployments. So there’s a huge market pressure to support RHEL 6 – lots of big companies would be willing to pay someone to make it work. Docker never supported RHEL 6.4 or older because its kernel simply lacked necessary functionality. They worked with Red Hat to backport some network-namespace-related stuff from newer kernels into the CentOS 6.5 and 6.6 kernels, but that effort proved to be buggy and insufficient so they have since dropped support for RHEL 6 entirely. (Though Red Hat will happily sell you Docker support and extra features on RHEL 7 😃 ) Docker doesn’t require patches because they’re working with, and extending, features that are baked into the core kernel. As I recall, networking was an issue at one point, as was capping physical memory (Linux has supported virtual-memory caps for a long time but I believe physical-memory caps are more recent). Other things too, I’m sure. These days, I think it’s filesystem stuff; their OverlayFS doc hints a little bit about the kinds of new kernel functionality that they’re using. WSL is keeping the Windows kernel team busy, but the Linux kernel team is busy too 😃

@yarmand I agree for not needing a VM - this is why I said support windows server containers, which I believe does not require Hyper-V (source). As for being complicated, it really wasn’t - I got it up and running in a matter of minutes. Of course, in my case, I was using Hyper-V as I’m on Windows 10.

I’m all for better Linux kernel emulation, just saying this might be an easier route. I’d like to have real containers on Windows 10 instead of using Hyper-V, though I realize that is an “upstream” concern.

Edit: that said, I’m not actually sure, since I haven’t tested it, if you can run a Linux container on Windows server containers without hyper-v … logic suggests no. In which case, full steam ahead on this issue! 👍

Edit 2: Actually, you should be able to run a Windows container with WSL inside windows server containers - over-complicated, yes, I see your point, but it would be better than nothing. Might not be so bad if other distributions were supported in WSL, other than just Ubuntu - but I Haven’t looked into this yet.

Seems to be related to #80. I’m not convinced that the log error is causing docker to fail to install (but what do I know, I’m just some random guy on the Internet), but it nevertheless isn’t working, just as you say.