system
Given the following post, respond as if you're commenting on Reddit:
human
Difference between Docker and LXC(Linux containers).

Not sure if this is an appropriate place to ask this. Please redirect me if it isnt. I've been reading about Docker and the Linux kernel features that it uses. However, I just cant figure out in simple terms what exactly is the difference between Docker and LXC. Is it correct to say that:
Docker is to LXC what Github is to git? 

Also, what features does Docker add itself as a service when the underlying technology that it uses is based on and built into the Linux kernel?
gpt
There isn't a lot of *fundamental* difference between Docker and LXC. They both use the same underlying Linux kernel features -- namespaces, cgroups, chroot, network bridge devices, and so on -- to provide isolation between processes running in different "containers".

The main thing that Docker provides and LXC doesn't is a slightly higher level of abstraction: namely, a distinction between "containers" and "images". With LXC, you typically treat a container like a virtual machine: you start it up, log into it, and then configure it. Docker is designed to be used in a more automatable, reproducible way: instead of configuring each container individually, you define an "image" that contains a complete snapshot of its filesystem, and then clone that image into the container's chroot before starting it up. It also provides convenient features for creating and distributing those images.

(From an implementation perspective, the crucial kernel feature that enables this functionality is the "overlayfs" filesystem. Overlayfs allows you to start with a "base" filesystem image -- for instance, a clean installation of Ubuntu -- and then derive multiple other images from it by installing packages, and then in turn run multiple containers with their own instances of that image's filesystem. The overlayfs filesystem makes it possible to start containers very efficiently by only storing the deltas between adjacent layers, while ensuring that changes to later layers don't propagate to the earlier ones they're based on. The Docker daemon takes care of managing this complexity behind the scenes; you can inspect the overlaid layers by browsing through `/var/lib/docker`.)