While going through docker docs, I found that docker is now using libcontainer instead of LXC. Has anyone idea about how libcontainer is better (if so..) than LXC ?
3 Answers
Linux Containers (LXC) was used before docker 0.9 (On March 13, 2014, with the release of version 0.9, Docker dropped LXC as the default execution environment and replaced it with its own libcontainer library) as one execution driver by docker, and offered a userspace interface for the Linux kernel containment features. It is very specific to Linux
libcontainer (now
opencontainers/runc
) is an abstraction, in order to support a wider range of isolation technologies as described in this article
That means Docker is abstracting itself from its original implementation, allowing other vendors (like CoreOS) to implement their own version of containers.
Note: since then (What’s the difference between runc, containerd, docker?) shows:
In 2016 the container space was booming and docker decided to split the monolith into separate parts, some of which other projects can even build on — that’s how
containerd
happened. That was Docker 1.11 (so pretty much ancient history).
Containerd is a daemon that acts as API facade for various container runtimes and OS. When usingcontainerd,
you no longer work with syscalls, instead you work with higher-level entities like snapshot and container — the rest is abstracted away.
If you want to understandcontainerd
even more in depth, there’s a design documentation in their GitHub repo.
Under the hood,containerd
usesrunc
to do all the linux work.
See more at "How containerd compares to runC"

- 1,262,500
- 529
- 4,410
- 5,250
-
question was about libcontainer, not about libnetwork – ISanych Dec 08 '15 at 12:02
-
@ISanych right, I'll rewrite the answer then – VonC Dec 08 '15 at 12:07
-
@VonC thanks for the reply. It means that, now docker has namespaces, cgroups ( from LXC ) and additional kernel features selinux, netlink, capabilities etc coming from libcontainer. Am I right VonC ? – Yogesh Jilhawar Dec 08 '15 at 13:12
-
@YogeshJilhawar yes, that is what the SPEC mentions (https://github.com/opencontainers/runc/blob/b741e3dc9da048b9f2393cb7ff3043a2fba36618/libcontainer/SPEC.md: amespaces, standard filesystem setup, a default Linux capability set, and information about resource reservations) – VonC Dec 08 '15 at 13:22
I would rather recommend you to go through this link to have a complete understanding of why Docker started libcontainer
http://www.zdnet.com/article/docker-libcontainer-unifies-linux-container-powers/

- 4,674
- 2
- 28
- 45
-
3While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Murmel Nov 27 '18 at 06:51
As I am aware.. LXC was default execution driver for docker engine to execute its container/namespace and other. Docker developed 'libcontainer' and added to their docker engine. Correct me if I am wrong.