Running Docker Windows and Linux Containers Simultaneously
Running Docker Windows and Linux Containers Simultaneously | Developer Support (microsoft.com)
Let’s Get Started
With Docker for Windows started and Windows containers selected, you can now run either Windows or Linux Containers simultaneously. The new –platform=linux command line switch is used to pull or start Linux images on Windows.
docker pull --platform=linux ubuntuNow start the Linux container and a Windows Server Core container.
docker run --platform=linux -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"docker run -d microsoft/windowsservercore ping -t 127.0.0.1Both containers are running on a single host.
If you list your local image cache you’ll see a mixture of both Windows and Linux images. To determine the operating system an image requires you can use docker inspect and filter on the “Os” property.
docker inspect --format '{{.Os}}' ubuntuConclusion
Running Windows and Linux containers simultaneously on the same host is an interesting new feature in Docker with lots of possibilities. However, this is an experimental feature and may have some issues. One known problem is volumes are not stable especially when mapping between Linux and Windows file systems. This can cause some containers that rely heavily on volumes to fail to load. Furthermore, tooling support is not yet complete. For example, Docker-Compose and Kubernetes cannot yet mix Windows and Linux containers. Microsoft is currently tracking issues here and feature progress can be tracked at the Github site here.
No Comments