JamesFaix
JamesFaix

Reputation: 8655

Why does Docker for Windows make you pick either Windows or Linux containers?

When using Docker for Windows, you must choose to either use Windows or Linux containers, but you can't use both at the same time. What is the technical reason(s) for this? It's a little counter-intuitive, since each container has its own isolated operating system.

Upvotes: 8

Views: 4618

Answers (2)

v.karbovnichy
v.karbovnichy

Reputation: 3306

Docker ecosystem on your Windows machine contains several components. One is Docker command line: the docker command that you use for everything-management. The second one is Docker daemon - A self-sufficient runtime for containers, the core.

Docker daemons for Linux Containers and Windows Containers are different, but they listen for connections from the docker client on the same pipe. So one needs to be stopped for other to be started. This is the technical reason that you asked for.

However, you can observe that containers started for ex. in MobyLinuxVM is still running and available for connections when you switch to Windows containers. The only thing here is that you cannot manage them because the Docker daemon for Windows does not know how to manage Linux containers in MobyLinuxVM.

UPDATE: As described in this post,

Docker for Windows 18.02 now supports Linux and Windows containers running side-by-side via LCOW, using a single Docker daemon.

So actually now you can use one docker daemon to manage both worlds, it's just about using the new --platform flag in docker pull.

Upvotes: 6

Miq
Miq

Reputation: 4279

Linux containers on Docker for Windows are not handled by windows itself, but they are using Hyper-V Linux VM - MobyLinuxVM. Hence the necessity to switch between Linux and Windows.

However starting from Windows 1709 and Docker in edge version you can try out linux containers on windows - see: https://blog.docker.com/2017/09/docker-windows-server-1709/

Update

As @v.karbovnichy brought up, technically on Docker for Windows you "can" run linux and windows containers simultanously - you can use docker-machine command to create additional linux-based virtual machine that will run your linux containers. Then, you can connect them into one swarm and, with a dose of good will, you will run linux and windows containers simultaneously on same machine.

docker client command itself can connect to both linux or windows docker-server and "manage" both of them - check docker login - it's widely used in server configurations.

However as stated above, true running linux and windows containers next to each other is in preview state.

Upvotes: 6

Related Questions