Docker vs. LXC—The Similarities and Differences

Docker vs. LXC The Similarities and Difference


  1. Docker is the hot topic at every tech conference, developer forum, and DevOps team meeting today. However, Docker isn’t the only (or the first) container technology. In fact, Docker itself was originally based on another container framework, Linux containers (LXC), which has been around for a decade.

Needs to understand Basic things:

  1. To start, we need to define the term virtualization as it is key to understanding what containers do. Virtualization creates a replica of a real instance like a server or an operating system. Virtual machines, for example, create a replica of a hardware server. They perform what’s called a hardware virtualization. Containers, on the other hand, virtualize something that’s one layer above the server—the operating system. In other words, a container makes multiple replicas of an operating system.

What is LXC?

  1. LXC provides full-system virtualization that’s similar to, but more lightweight than a VM. LXC boots faster than a VM and uses less RAM. Because it’s very similar to VMs, all the custom scripts that IT teams have created to manage VMs can be ported over to manage LXC as well.

What’s LXC used for, and by who?

  1. LXC is primarily used by Ops teams that need a more lightweight, yet similar alternative to VMs. While it finds use in production environments, LXC is not well-suited for development and test environments because it doesn’t bring any benefits to how application code and its dependencies are packaged.

What does Docker inherit from LXC?

  1. Docker shares a lot of foundational components with LXC. For starters, they have the same goal: to create a virtualized isolated process that’s much lighter than virtual machines. Both LXC and Docker use similar kernel features for security and process isolation. This includes core kernel security features like cgroups, namespaces, selinux, apparmor, and seccomp. Docker inherits all these security features from LXC using its runtime—runC. These security features provide process isolation, and restrictions on running processes so that resources are utilized by them fairly.

Who uses Docker?

  1. While LXC is used primarily by Ops teams as lightweight VMs, Docker has massive adoption among developers and QA. Unlike LXC which is an OS container, Docker is an application container. OS containers were already being used by Ops teams, but Docker came along and brought the benefit of containerization to the masses of developers. Though initially gaining adoption by developers, Docker is today becoming a household name for every IT team.