Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a Docker/LXC container a running app or something in-memory?

I just read the excellent SO question asking "What is the difference between Docker and a VM?". However, the accepted answer left me wanting just a wee bit more.

I sort of understand a container (Docker/LXC - I don't get the difference) to use something called libcontainer and AuFS so that dozens, hundreds, even thousands of containers can share the same CPU, RAM and disk resources. But, the answer still doesn't explain exactly what a "container" is!

Is a container just an instance of this libcontainer running? Is it an application that uses libcontainer? Is it something Linuxy like a service/daemon process? So I ask:

  • What exactly is a "container"?
  • What are the exact computing/system resources multiple containers can share inside the same VM/physical?
  • Is Docker/LXC the "hypervisor" in the container equation? If not, what is the relationship between Docker, LXC and libcontainer?
like image 465
smeeb Avatar asked Jan 22 '15 02:01

smeeb


People also ask

Do Docker containers run in memory?

By default, Docker containers have access to the full RAM and CPU resources of the host. Leaving them to run with these default settings may lead to performance bottlenecks. If you don't limit Docker's memory and CPU usage, Docker can use all the systems resources.

What is difference between LXC and Docker?

LXC provides a set of tools to manage your container as well as templates to create a virtual environment of the most common Linux OS. Docker is an open-source containerization technology that focuses on running a single application in an isolated environment.

Is LXC a container runtime?

LXC is a well-known Linux container runtime that consists of tools, templates, and library and language bindings. It's pretty low level, very flexible and covers just about every containment feature supported by the upstream kernel.

How does Docker use LXC?

Docker is developed in the Go language and utilizes LXC, cgroups, and the Linux kernel itself. Since it's based on LXC, a Docker container does not include a separate operating system; instead it relies on the operating system's own functionality as provided by the underlying infrastructure.


1 Answers

the answer still doesn't explain exactly what a "container" is!

A container is basically a process, isolated, with all the environment it needs for its job (a webserver, a database, a CMS, any software...).

A container uses Linux kernel namespaces to isolate process, network and filesystems. A container uses the concept of process isolation: filesystem, process, network, resource (CPU, memory),logging (STDIN...), shell isolation.

Docker/LXC - I don't get the difference

LXC is a set of tools to control containers; Docker is another set of tools (all bundled into the same program), that also adds a file format so the contents of an 'image' can be passed around from machine to machine. Docker is vastly more talked-about than LXC. Docker used to use the lxc library to control containers, but replaced it with its own library called...libcontainer.

What are the exact computing/system resources multiple containers can share inside the same VM/physical?

Containers on the same machine will share CPU, memory and the kernel. Additionally, Docker lets you optionally have them share the same network.

Is Docker/LXC the "hypervisor" in the container equation?

The Linux kernel is the real "hypervisor", and Docker/LXC are sending it commands to create and control containers.

like image 130
user2915097 Avatar answered Oct 20 '22 00:10

user2915097