Disclamer
This! is! Very! Higly! Experimental!
So friendly advice, test it somewhere you don't break anything. You're warned, don't blame the Swiss Guy after that!
The goal
Since Docker 1.12 (beta) shipped and the incredible feature of swapping daemons appeared, I had the idea that actually both could run in parallel.
I simply didn't knew "how" exactly it could be done, as Docker implemented a proxy that stops and starts either daemon you decide to switch to (read Stefan's blog, really more detailed than my 2 Swiss Francs explanation :)
Still, the Linux daemon being containerized in Hyper-V MobyLinuxVM, and the Windows Containers relying on the "Containers" feature (which by the way comes with Hyper-V isolation by default), there should be a way to run them at the same time, right?
The setup
Thanks to the Windows Subsystem for Linux (WSL), my goal was to use Bash for "Linux Docker" containers and Powershell for "Windows Docker" containers on the same machine.
So in order to have it running correctly, I needed to had the following components:
- Windows 10 with Anniversary Update (I'm currently an Insider within the Slow Ring realm)
- WSL + Containers + Hyper-V features enabled
- Docker for Windows (beta channel)
- Docker client on WSL (see my blogpost or Google Search)
Daemons are coming
Feeling ready? then let's mix it up as Docker puts it nicely, "Happy Hacking":
- Via the Docker Tray, switch to Linux Containers (if not already done).
Or, for the Terminal lovers, run:
C:\Program Files\Docker\Docker\DockerCli -SwitchDaemon - From Bash (or Powershell), set the DOCKER_HOST variable and check the version:
$ docker version - [Linux Milestone]Good, our "Linux environment" is up and running. Now time to address the Windows one.
- Open a first Powershell window as Administrator !!! MANDATORY !!!
- Normally, the docker path should be in your $env:PATH already. So to start a new docker daemon, run (see notes section for more details):
dockerd.exe -H npipe:////./pipe/docker_engine_windows -H 0.0.0.0:3625 - From another Powershell window, set the DOCKER_HOST variable to the new NPIPE and Port and check the version:
- [Windows Milestone]Good, our "Windows environment" is up and running in parallel of the Linux one:
Notes
- The exact named pipe name was found in Stefan's blog post section: Proxy for the rescue
- I did not make anything permanent as you can see. This only served as a test and is highly experimental. I don't have an in-depth vision of the mechanics behind docker, and running two daemons could bring pain and suffering to your existing implementations.
- My next attempt will be to actually start the Windows Docker daemon with TLS enabled. This is crucial if, not like me, you are running your Docker instances in the Cloud and not in your own laptop (Surface Pro 4 in my case)
Once again, THANK YOU Stefan Scherer's Blog. If you pass by the French side of Switzerland, come say hi :) - First "joke", concerning the port chosen: I took a picture of a Nokia 3210 and checked how to write Docker (362537), as it was a bit too high, I only took the "DOCK" portion.
- Second "joke", I do have another blog post unpublished with the "other way" on how to actually connect to the Docker host running on the MobyLinuxVM.
It's unpublished as I could not figure it out on how to connect directly to the Docker port on the VM.
So if anyone tried and succeed, please let me know.