Running systemd inside a docker container (arch linux)

Michael Neale asked:

I am trying to see if I can run systemd inside a docker container (which is running arch linux in the container).

I start docker with all capabilities, and bind mount in cgroups:

docker run -it --rm --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro ..

however, if I try to run the systemd binary:

Trying to run as user instance, but the system has not been booted with systemd.

Trying to find out how to init things correctly to systemd starts.

My answer:

To run systemd in a Docker container, the host system must also run systemd. This means you cannot use Ubuntu as the host. At this time the only host distributions I know of that work are Fedora (which, unlike Ubuntu, has the latest version of Docker) or RHEL 7.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.