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 <<<


  1. nice post! Thanks for delivering a good stuff related to DevOps, Explination is good, nice Article
    anyone want to learn advance devops tools or devops online training
    DevOps Online Training
    DevOps Online Training hyderabad


Post a Comment

Popular posts from this blog

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…

Secure nested LCOW: Part 2

What's in Part 2?After the configuration of the Host VM hypervisor (part 1), we will get the following components configured: Windows 2016 with nested Hyper-V, Containers and WSL rolesDocker daemon installed (no SSL)Docker daemon configured with SSL Setup: Windows 2016 Serverthis one will be longer, even if I will only list the commands and reference the guides I followed to have my Docker host configured inside the Hyper-V VM. Which means it will not contain any output and, more importantly, I won't put the explanations that the guides provide.
I strongly recommend that you click on the "source" links and look at their great content.

Also, I won't explain how to install the OS, just note that you should choose the Windows 2016 Server 1709 version (I picked the Standard version).
Adding the roles Add Hyper-V and the Containers rolesPS> Enable-WindowsOptionalFeature -Online -FeatureName containers -All -NoRestart PS> Enable-WindowsOptionalFeature -Online -Featur…