Docker Community Forums

Share and learn in the Docker community.

Docker for Windows and Windows Subsystem for Linux

(Lewisl9029) #1

I just got into the Docker for Windows beta the other day, and I haven’t had a chance to try out the Windows Subsystem for Linux yet, but I’m curious how these two technologies would work together.

For instance, would I be able to access the Docker for Windows client directly from the Linux Subsystem? Or would I have to use the native Linux Docker client to connect to the Docker engine running in the Docker for Windows VM manually (and if this is the case, any plans to streamline this use case as well)? Or maybe the Docker team has some other ideas in mind for potential integrations between these platforms? If so, I’d love to hear about them.

Docker for Windows is great for teams that use Windows exclusively, but running the Docker client in Powershell/CMD still complicates things for the cross-platform use-case due to differences in the scripting language between Powershell/CMD and Bash. I’d love to hear how others in the community might be using Docker and Docker for Windows in a cross platform setting without having to maintain separate scripts for each platform.


(Alexander Trauzzi) #2

Totally agree, it would be great if the docker tooling worked on the upcoming Ubuntu-on-Windows shell. This would address several issues, especially pertaining to terminal support.

Unfortunately, numerous attempts from multiple people to raise the topic of Docker client support have not been clearly understood by the team working on Ubuntu on Windows/Bash on Windows.

The canned responses tend to be “We aren’t supporting Docker”. What I feel like that is originating from is a policy statement that wasn’t clarified enough. Running docker and running the docker client are two very different things and I should think that the client tools would be a trivial scenario to ensure are working.

What’s needed here is some advocacy on our part. I’d be willing to open a new github ticket reinforcing my concerns from the ticket I linked above. There have definitely been others who have been punted with the boilerplate “Docker is not a supported scenario”, but again… I don’t think it’s getting due consideration.

Just make those tickets and also ping Rich Turner on twitter about this stuff. Advocacy helps as does everyone repeating the same thing: CLIENT NOT SERVER

(Michael Friis) #3

@atrauzzi @lewisl9029 I believe the Docker CLI should work running in WSL but you need the Linux binary, not the Windows one. Eg. grab linux/amd64/docker from

I haven’t tried this personally, but I believe it works.

(Alexander Trauzzi) #4

Yeah, I tried the Linux binary (that’s what WSL is). But it doesn’t work. Just hangs when you try to run it.

(Lewisl9029) #5

@atrauzzi Thanks for your input! Wow. I had just assumed that you could run the native Linux Docker client on WSL and access a remote docker-engine through it, but apparently even that’s not possible yet? There goes my backup plan…

Really hoping someone from either Microsoft or Docker could take a look at this. Adding my support to your GitHub issue.

(Michael Friis) #6

@atrauzzi @lewisl9029 are you setting DOCKER_HOST before invoking?

(Martín Coll) #7

Just installed docker-engine by following I can connect to the Hyper-V host by calling DOCKER_HOST=localhost:2375 docker ps.

Can’t build though because of the following error:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /mnt/c/Users/......../Dockerfile-build: no such file or directory

(Browniepoints) #8

The nature of Docker (low-level Hyper-visor manipulation) means that it makes demands of WSL that aren’t supported. WSL is designed to allow say a ruby developer to develop and test their ruby application as if they were doing their development on Linux.

If you think about it Native Windows Docker and the WSL for the most part cover the same needs. Except (in theory) Docker on windows will support running server loads full time under windows where as the WSL is designed for development and test only.

(Lewisl9029) #9

@browniepoints Docker-engine obviously can’t run under WSL, but the Docker client should technically be compatible with WSL since it’s entirely in userspace. We’re finding out according to multiple reports that even the Docker client doesn’t seem to work correctly under WSL, which is the issue at hand.

(Michael Friis) #10

@lewisl9029 I think it works if you set DOCKER_HOST (less filesystem-funk when building)

(Wilfried) #11

Hi @lewisl9029

If you currently use the docker for windows beta ( version 1.11.1-beta13) at the moment.

You can install docker-engine inside “bash on ubuntu on windows by canonical” (i have just followed the installation guide here : ).
The ubuntu version is “Trusty”, you don’t need kernel, extras and apparmor).

installation should be ok but starting the docker-engine is impossible dues to a limitation on the socket :
time=“2016-05-26T09:10:09.506773600Z” level=fatal msg=“can’t create unix socket /var/run/docker.sock: listen unix /var/run/docker.sock: setsockopt: invalid argument”

Then, start docker for windows and try this on bash prompt :
$ docker -H localhost:2375 run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
4276590986f6: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:4f32210e234b4ad5cac92efacc0a3d602b02476c754f13d517e1ada048e5a8ba
Status: Downloaded newer image for hello-world:latest

Hello from Docker.

I have not done more tests yet, but it seems fine

i hope that help a little

(Rolf Neugebauer) #12

There are a number of issues making this quite complicated. For starters there is the basic communication between client and daemon:

  • by default the Linux docker client communicates with the daemon over unix domain sockets. I haven’t checked yet if they are supported on WSL and if they are accessible outside the WSL environment. You could use DOCKER_HOST and communication over the network. This may work in simple cases but is likely to break in more complex scenarios. Docker for Windows currently only supports the localhost:2375 communication to support compose, but this may go away because:
  • by default the Windows docker client talks to the daemon via a named pipe. This is what the docker cli talks to on Windows. Named pipes are windows special and are not avail in WSL, AFAIK.
  • In order to make the client integration seemless we proxy docker client connections to the daemon and rewrite some small portions of the requests/responses on the fly. Since the Linux client on WSL would use a different mechanism that would be trickier to do.

This is just the basics and are probably doable at some point, but it becomes a lot trickier if you want to do volume mounts and the like. The WSL filesystem seems to be a transparent union mount with some of the user data living in AppData and other parts of the WSL root filesystem elsewhere. It’s unclear how one would untangle this and present in a comprehensible way to the user to use the -v option. There are also differences in filesystem semantics between the filesystem used by WSL and NTFS (symlinks etc) which will be very confusing to users if they see a symlink in WSL but no symlink in a volume shared with a container.

These are just some issues, and there are likely more, but I agree it would be cool to have docker for Windows work with WSL, but it might just not be possible (or very very hard)

(Itopia) #14

Hi. Any chance of getting re-considered? I’ve been fiddling with Docker+WSL+Windows 10 last couple days and can whilst it’s all pretty impractical and not KISS; I think just being able to tweak DOCKER_OPTS could really help.

I’ve aliased docker=docker -H localhost:2375 in WSL and run containers on the Windows host. I’ve also been able to share data using -v ///c/dir/dir which is the same launching a container in WSL or from Powershell.

What I can’t do, is start docker with DOCKER_OPTS or get scripts to alias docker as per the above, so try and call docker locally - and fail. At least being able to have the option DOCKER_OPTS would give us more to play with!

(Dashesy) #15

I also stumbled upon this exact problem. Docker on WSL is an almost finished solution now! But I could not figure out a good way to mount a volume from WSL that I could use inside the docker.

(Khatribharat) #16

Have a look at this :

(Kcd83) #17

What people here are asking for is bash on Windows with access to Linux Docker for Windows so the full Linux experience on Windows.

In short, change Docker for Windows to expose daemon without TLS, then ignore/remove the WSL apt docker package (doesn’t even install the binary ?!?!)

Like this:

sudo curl -sSL | sh
export DOCKER_HOST=tcp://localhost:2375