Docker containers have their own kernel or not?

I see that a lot of docker images in the docker repository are made with an Ubuntu base.

What does that mean? Does each container bundle a stripped down version of the Linux kernel?

Do containers sit on top of their own kernels? But I thought containers share the kernel of the host (which in some cases is boot2docker, a custom Tiny Core Linux build, and in others something like CoreOS).

EDIT: Clarifying the question a bit. Yes I know docker is a process container, not a full VM. But since there are “Ubuntu” containers in the official docker hub registry and other OSes like CentOS, what does it mean to run Ubuntu in a container?

Answer: Ahh it just dawned on me. It is the Ubuntu user land processes, containing apt-get and other configuration processes for a particular Ubuntu build. Similarly for CentOS. Docker is not single process, just single entry. So for these distributions the entry point is some sort of init process that spawns other processes.

Answer

Docker uses host OS kernel, there is no custom or additional kernel inside container. All containers which run on a machine are sharing this “host” kernel.

Wikipedia says http://en.wikipedia.org/wiki/Docker_(software) that

Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent “containers” to run within a single Linux instance, avoiding the overhead of starting virtual machines.

cgroups, namespaces and LXC are features of Linux kernel to isolate groups of processes; there is still single kernel, single scheduler, and one instance of kernel memory manager.

Boot2docker and CoreOS are just lightweight Linux distributions with some host kernel; they can be used to load Docker containers.

http://boot2docker.io/

boot2docker is a lightweight Linux distribution based on Tiny Core Linux made specifically to run Docker containers. It runs completely from RAM, weighs ~27MB and boots in ~5s (YMMV).

http://en.wikipedia.org/wiki/CoreOS

A single control host (CoreOS instance) runs multiple isolated Linux systems (containers), using Docker as an additional layer of abstraction and interface[14] to the underlying operating-system-level virtualization features of the Linux kernel. … This approach relies on the Linux kernel’s cgroups functionality, which provides namespace isolation and abilities to limit, account and isolate resource usage (CPU, memory, disk I/O, etc.) for the collections of processes.

Attribution
Source : Link , Question Author : stewart99 , Answer Author : Scott Stensland

Leave a Comment