Skip to main content

Docker + WSL: Get 2 daemon for the price of 1


almost two years ago, Docker announced the capability of switching between the Linux and Windows containers "mode" (far from the right click that we have today).
At that time, I wrote a blog post on how to run both daemons at the same time (

Fast forward to 2018, and while we were blogging on how to get the TLS connection from WSL docker client with Rory McCune (, another blog post, by Stefan Stranger drew my attention (read: blew my mind) as I was trying to reproduce the same: how could I "bind" the docker socket in WSL with the Docker for Windows Linux mode socket (

From 1 to 2 daemon: DemonHunter mode achieved

Now that we have all the required setup resources, let's bind them together. And because there's nothing as "you just have to ...", I might point out at obvious steps, so just skip them if you already know or have implemented them.


  1. You have Windows 10 installed
  2. You have WSL enabled (
  3. You have Docker for Windows, Edge channel installed (


  1. Install the Docker client in WSL as described in the "Third up" step from Rory's blog
  2. Build the Npiperelay according to Craig Wilhite's blog
    • The only change is in the "Last steps" and the content of the script. Change the line:
      exec socat UNIX-LISTEN:/var/run/docker.sock,fork,group=docker,umask=007 EXEC:"npiperelay.exe -ep -s //./pipe/docker_engine",nofork
      exec socat UNIX-LISTEN:/var/run/docker.sock,fork,group=docker,umask=007 EXEC:"npiperelay.exe -ep -s //./pipe/docker_engine_windows",nofork
  3. Run the script
    $ ./docker-relay &
  4. Try it out
    $ docker version

Here is the gif showing both daemons running in parallel:

Cool, but WHY?!?

Well, as an hobbyist, I will always answer: why not?
Then, the "more technical" reason would be that now I'm able to run in parallel both Windows Containers and Linux Containers On Windows (LCOW)  and Linux Containers on MobyLinuxVM which brings now the more than famous Kubernetes (k8s) as a single node cluster.

Now, as I'm really not a Dev, I would be more than interested to see how you could leverage this setup.
So tag me on Twitter so I can see how much fun you have.


first of all, if you reached this lines then I do thank you, and as such here is two small additions to the setup above if you want to make it "permanent":
  1. Create a Scheduled task
    • First in WSL, make a link of your "docker-relay" file to the default system directory (in my case Corsair distro based on Ubuntu):
      $ sudo ln -s ~/docker-relay /usr/local/bin/docker-relay
    • Press the Windows key and type "Schedule"
      • Click on the "Task Scheduler" option
    • Click on the "Task Scheduler Library"
    • On the right menu, click on Create Basic Task
    • Give it a title > Click Next
    • Select when the task should run > Click Next
    • Select the "Start a Program option" > Click Next
    • Pick your distro name (if custom) or simply "bash.exe" with the argument "-c sudo docker-relay" > Click Next
    • Review the settings and check "Open the Properties dialog..." > Click Finish
    • In order to have a "quiet mode" of the WSL window (not appearing on screen), select the option "Run wheter user is logged on or not" > Click OK
    • Type your password
    • Back to the Task Scheduler main window, scroll down to find your newly created task in the middle top section and click "Run" on the down right menu
    • Restart or Log off/Login and your task should run

>>> Nunix Out <<<


Popular posts from this blog

Scripting with GO: what about Windows?

!!! Warning !!!Once again, let me repeat, I'm by no means a developer nor a sysadmin (at least no more since 5 years).
This means that, while the solution below worked for me and I could reproduce it, it's not 100% safe neither!
Also, my solution still feels incomplete (read further), so if someone know the tweak to make it even more compete, please share it and reach out in Twitter, I'll be waiting.
IntroductionBy now, everyone following @jessfraz read her take about the very neat "little hack" from @cloudflareUsing Go as a scripting language in Linux

As a good WSL Corsair, I tried it and it just worked!
But then, based on my latest playground of having a seamless coding experience between WSL and Windows (thanks @bketelsen for the love and notification spam), I really thought it would be unfair to "my Windows side" to not be able enjoying the fun of GO scripting (yes, split personality is bad).

So as the good Corsair I am, it was time to see if some shinn…

WSL: One Home to host them all

IntroductionThis blog post will explain how a single home mount can be shared accross all the WSL instances. It was quite fun to find the idea and then make it happen. It will use all the tools currently available from WSL, so please don't expect a "Linux only" as Interopability will be heavily used. And before I start, here is my point of view about WSL: It's not only Linux!
It's different, just like GNU is different from Unix (yes I said it).We have finally the strength of both worlds combined. And while I do understand the "dev" aspect is meant to be reproducible in a Linux prod environment, the "ops" side is meant to take advantages of everything that can make the full environment feeling Home. Setup requirementsIn order to really enjoy this solution, I do recommend having 2 or more WSL distros installed or, if you fell like a real WSLCorsair, try @bketelsencrazy setup (I love it)!
While the distros are downloading, let's prepare the Windo…