Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 454
JamesFaix Avatar asked Apr 06 '18 08:04

JamesFaix


People also ask

Is it better to run Docker on Windows or Linux?

Use Linux for Containers, it is always the best option. Windows 7 or Windows 10 Home doesn't support Docker, you need to use Docker Toolbox which is not great. There is no support for Windows containers in most cloud providers or Kubernetes.

What is difference between Linux container and Windows container?

The biggest difference is the container image. Windows images are larger than Linux images. When you run your container the Docker image is downloaded and it takes a bit longer than downloading a Docker image based on Linux.

Can the same Docker container run on Linux and Windows?

You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.

Is Windows containers the same as Docker?

You use the same Docker images and the same docker commands for Windows Server and Hyper-V containers. The runtime is different, but the containers behave in the same way.


1 Answers

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.

like image 52
Miq Avatar answered Nov 11 '22 18:11

Miq