Container Integration in systemd

systemd incorporates a container manager called systemd-nspawn [1]. In this post I'll show how to build and start containers on Debian Jessie.

First, lets install the prerequisites:

Next, let's build the container file system:

To start the container and connect with console run:
The container is now running, sharing the network name space of the physical host.

To launch the container in its own network namespace with one interface connected to a bridge on the host first create the bridge:

The container now has a network interface named host0:
On the host a new virtual interface (the other end of the connections from the container) is connected to the bridge:
Systemd can control the containers just like any other service by specifying a unit file:

Here's a detailed example of how to start multiple containers running Redis on different ports:

No comments:

Post a Comment