Apache Mesos - Containerizer Internals

Containerizer

Containerizers are Mesos components responsible for launching containers. They own the containers launched for the tasks/executors, and are responsible for their isolation, resource management, and events (e.g., statistics).

Containerizer internals

Containerizer creation and launch

Types of containerizers

Mesos currently supports the following containerizers:

Composing Containerizer

Composing containerizer will compose the specified containerizers (using agent flag --containerizers) and act like a single containerizer. This is an implementation of the composite design pattern.

Docker Containerizer

Docker containerizer manages containers using the docker engine provided in the docker package.

Container launch
  1. Mesos agent runs in a docker container
  1. Mesos agent does not run in a docker container

Mesos Containerizer

Mesos containerizer is the native Mesos containerizer. Mesos Containerizer will handle any executor/task that does not specify ContainerInfo::DockerInfo.

Container launch

##### Launcher

Launcher is responsible for forking/destroying containers.

Linux launcher

Starting from Mesos 1.1.0, nested container is supported. The Linux Launcher is responsible to fork the subprocess for the nested container with appropriate Linux namespaces being cloned. The following is the table for Linux namespaces that are supported for top level and nested containers.

Linux Namespaces
Linux Namespaces Top Level Container Nested Container
Mount Not shared Not shared
PID Configurable Configurable
Network & UTS Configurable Shared w/ parent
IPC Not shared -> configurable (TBD) Not shared -> configurable (TBD)
Cgroup Shared w/ agent -> Not shared (TBD) Shared w/ parent -> Not shared (TBD)
User (not supported) Shared w/ agent Shared w/ parent

*Note: For the top level container, shared means that the container shares the namespace from the agent. For the nested container, shared means that the nested container shares the namespace from its parent container.

Posix launcher (TBD)

##### Isolators

Isolators are responsible for creating an environment for the containers where resources like cpu, network, storage and memory can be isolated from other containers.

Containerizer states

Docker

Mesos