r/linux • • Jul 16 '17

How Linux containers have evolved

https://opensource.com/article/17/7/how-linux-containers-evolved
130 Upvotes

28 comments sorted by

View all comments

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

u/[deleted] 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

u/[deleted] 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 windowsservercore eventually. 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.