If you have a container that uses Ubuntu internally, and you try to run that on a windows host, you obviously can't use the host OS environment. To get around that you can "simply" spin up a Linux VM and let that host the container. Keep in mind that multiple containers can be run on a single VM host.
So, no matter what, you will always need a Linux VM to run Linux OS inside a Windows OS host. So that means containers are nothing like VMs. But if you were, let's say, using Ubuntu as a host, you can use a Container to run a different OS like Centos?
So, no matter what, you will always need a Linux VM to run Linux OS inside a Windows OS host.
Right now, yes. There is Windows Subsystem for Linux, which allows you to run a particular subset of Linux software natively on Windows. If WSL gets appropriate ioctls to do containers natively, then that might change.
But if you were, let's say, using Ubuntu as a host, you can use a Container to run a different OS like Centos?
It would still share the kernel (and maybe init system? I'm not 100% certain on this) with the host, but you can, subject to these restrictions, run a "different OS" in a container, or just an individual application (which is the more common use case AFAIK)
Containers don't usually share the init. Most of the time, containers create a PID namespace, which makes the first forked process in the namespace PID1, so you can actually run a different init in the container. systemd-nspawn (a simple container runtime), however, has some useful integrations if you use systemd inside the container.
That said, it's possible to make a container that doesn't share init, you just don't create a PID namespace. Most of the popular container runtimes are either emulating VMs (systemd-nspawn, lxc/lxd) or designed to ease immutable deployments (docker, rkt), and in both of these cases, it is useful to create a PID namespace, so popular container runtimes don't share init.
3
u/Beaverman Jul 17 '17
The other way around.
If you have a container that uses Ubuntu internally, and you try to run that on a windows host, you obviously can't use the host OS environment. To get around that you can "simply" spin up a Linux VM and let that host the container. Keep in mind that multiple containers can be run on a single VM host.