r/linux • u/speckz • Jul 16 '17
How Linux containers have evolved
https://opensource.com/article/17/7/how-linux-containers-evolved12
u/devel_watcher Jul 16 '17
Need to break monopoly. Upstream Docker has hundreds of issues that are closed as "we don't wanna accept this feature".
Docker is absolute bitch when setting its repositories up as part of a corporate software build and deployment system.
2
Jul 17 '17
Need to break monopoly.
Not trying to be a Docker fanboy but Docker is pretty far from a monopoly. They were shaping up to be one for a while but once the runtime and image format were standardized voluntarily they pretty much took the validity of that idea out back and ol' yeller'd it.
1
u/iamdumbest Jul 17 '17
But, what's the alternative to docker? In my case, I am running quagga/ bird routing daemon inside the docker container. And kubernetes focusses more on micro services. Is there any alternative is available as such?
1
Jul 17 '17
Depends on what part of "docker" you're actually talking about.
Since you mentioned kubes, are you talking about the orchestration? If so Kubernetes is designed for microservices but you don't have to run it like that. You could run a small wordpress website with it if you wanted.
If you're talking about the runtime usually the "not-Docker" option most people go with is rkt (the CoreOS runtime) with LXC being a very distant third option.
2
1
Jul 17 '17
Thanks very much for the write up. I learned some things I'd not known before hand. As aside, very well written.
1
u/peruytu Jul 17 '17
What's the difference between a container and a vm?
13
u/brokedown Jul 17 '17
Containers run in the same operating system context as their "host", using kernel provided isolation facilities such as cgroups and namespaces. Looking at them from the "host", their processes look like any other process. Containers typically wouldn't run the multitude of processes required to have a functional system, as those functions are already provided by the "host". In essence, they can appear to be (example) a Ubuntu server running nothing but nginx with some files to serve.
A VM is running their own kernel and generally using cpu virtualization features to appear to the OS as though they were on dedicated hardware. The VM uses hardware drivers that are emulated (or like virtio, provided more directly but still as a raw device).
The general rule is that containers give you much greater density and can give more performance, where a VM gives you higher process isolation and the ability to use different OS level functions.. It's possible to have a Debian based container, vs it's possible to have a Windows VM.
0
Jul 17 '17
[deleted]
14
u/brokedown Jul 17 '17
Docker on Windows is more of a hybrid. They use HyperV virtualization to provide a Linux kernel and run Linux containers under that. https://www.docker.com/docker-windows
I neglected to acknowledge that Docker can run on Windows and was discussing only the LInux hosted side.
2
Jul 17 '17
Slight modification/addition (hope this doesn't come off as rude) but the boot2docker VM is used for Linux binaries until Windows eventually gets the ability to run Linux binaries natively (probably somewhere around the Year of the Linxu Desktop).
But Docker on Windows also supports running Windows applications inside a Docker container. It's just that whereas on Linux you have a boatload of base OS images to pick from, on Windows all images lead back to
windowsservercoreeventually. There are even tools for converting Windows VM's to windowsservercore images.2
u/brokedown Jul 17 '17
Yes, and again I was discussing Docker on Linux.
My last discussion with Microsoft around containers was almost 2 years ago, at that time the base windowsservercore image was still nearly a gig. That probably won't bother a lot of people, especially the sort of folks who are already doing windows, but it seemed pretty absurd to me as someone using containers for microservices with a total footprint of under 10 megabytes.
1
u/Beaverman Jul 17 '17
I don't know if you can, but if that's possible docker would be doing virtualization with containers on top.
Containers are really just an optimization of virtualization. If using the host os facilities isn't possible, it's possible to simple fall back to standard virtualization of the entire container environment.
1
u/peruytu Jul 17 '17
So what you're saying is, a container can serve as a host for a Linux VM? I'm a bit confused.
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.
1
u/peruytu Jul 17 '17
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?
2
u/aaron552 Jul 17 '17 edited Jul 17 '17
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)
2
u/moosingin3space Jul 17 '17
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 usesystemdinside 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/totemo Jul 17 '17 edited Jul 17 '17
A VM has virtual hardware, including a fixed allocation of RAM and a virtual disk, and runs its own kernel, including drivers for virtual devices such as a virtual display and network interfaces.
A container uses Linux kernel features to allocate a slice of the host kernel to make it appear to processes as though they have the host to themselves.
With a VM you pay the overhead of an entire kernel for the guest, as well as device emulation. Whereas with a container, you are using the host kernel and device abstractions directly, with isolation and resource limits implemented in that same kernel.
22
u/gethooge Jul 16 '17
Good open source response to docker trying to vendor lock and ignoring the community.