7

We currently use a Windows based server to host 2 VMs. One VM uses Windows with a Windows app and the other VM uses Linux with a Linux app.

Is the below scenario possible?

Bare server with Windows 2016 (no VMs). Install Docker engine. Install Windows app container. Install Linux app container.

Does the Docker engine abstract away the OS such that this configuration will run both apps? Meaning that the Docker engine works as an "interpreter" akin to how Java code can run on various OS's?

  • 1
    Details are here, mainly you need a linux VM to run linux containers just to provide a linux kernel ... docker containers are isolated processes, so they need a host, the linuxkit is just that but integrated within the docker run command for ease of use. – Tensibai Oct 11 '17 at 14:05
  • Shouldn't this be an answer? – Dan Cornilescu Oct 11 '17 at 15:21
  • 2
    @Dan presently at the chef summit, I was a little short to write a correct answer :) so I just dropped a comment – Tensibai Oct 11 '17 at 17:01
  • Not sure what your Windows app is doing, but you could also consider switching to dot net core since it's cross-platform. That way you can run everything on Linux. – frennky Oct 11 '17 at 19:27
6

Does the Docker engine abstract away the OS such that this configuration will run both apps?

No, it does not. Docker uses containerisation as a core technology, which relies on the concept of sharing a kernel between containers. If one Docker image relies on a Windows kernel and another relies on a Linux kernel, you cannot run those two images on the same OS.

When you install Linux Docker on Windows, you're actually setting up a Linux VM in Hyper-V, the LinuxKit details are here. You can open the Hyper-V console and see a VM called "MobyLinuxVM". There's a lot of work done to abstract this away from you e.g. the docker binary can connect to the Linux VM and run the same commands you're used to, networking between the host and VM tries to be seamless, volume mounting, etc. Ultimately it's not Docker that lets you run a Linux Docker image on Windows, it's just plain old virtualisation.

2

Yeah go nuts, you can run whatever you want in the container so long as the host supports virtualisation and can run the docker binary!

  • still I think there are some details to running Windows/Linux containers, or? – Peter Oct 11 '17 at 13:42
  • I think you need LinuxKit as well but you end up with the same functionality that's available on Linux – Briansbum Oct 11 '17 at 14:00

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.