Skip to content

fauust/docker-systemd

Repository files navigation

docker-systemd

pre-commit build

Multi-arch docker containers for systemd/openrc testing. Images are available on:

  • ghcr.io
  • docker.io

Build

docker build . -f Dockerfile.debian -t systemd-debian-sid  --build-arg base_image=debian:sid-slimdocker build . -f Dockerfile.redhat -t systemd-almalinux-8  --build-arg base_image=almalinux:8docker build . -f Dockerfile.alpine -t openrc-alpine3.20  --build-arg base_image=alpine:3.20

Example base_system arguments :

  • debian:11-slim
  • debian:12-slim
  • debian:sid-slim
  • ubuntu:18.04
  • ubuntu:20.04
  • ubuntu:22.04
  • ubuntu:24.04
  • fedora:39
  • fedora:40
  • fedora:41
  • almalinux:8
  • almalinux:9
  • rockylinux:8
  • rockylinux:9
  • alpine:3.17
  • alpine:3.18
  • alpine:3.19
  • alpine:3.20
  • alpine:3.21

You can also use "non-slim" Debian images (debian:11) but we only build images based on -slim versions of Debian images.

The following containers are available from Docker Hub.

docker pull ghcr.io/fauust/docker-systemd:debian-11docker pull ghcr.io/fauust/docker-systemd:debian-12docker pull ghcr.io/fauust/docker-systemd:debian-siddocker pull ghcr.io/fauust/docker-systemd:ubuntu-18.04docker pull ghcr.io/fauust/docker-systemd:ubuntu-20.04docker pull ghcr.io/fauust/docker-systemd:ubuntu-22.04docker pull ghcr.io/fauust/docker-systemd:ubuntu-24.04docker pull ghcr.io/fauust/docker-systemd:fedora-39docker pull ghcr.io/fauust/docker-systemd:fedora-40docker pull ghcr.io/fauust/docker-systemd:fedora-41docker pull ghcr.io/fauust/docker-systemd:almalinux-8docker pull ghcr.io/fauust/docker-systemd:almalinux-9docker pull ghcr.io/fauust/docker-systemd:rockylinux-8docker pull ghcr.io/fauust/docker-systemd:rockylinux-9docker pull ghcr.io/fauust/docker-systemd:alpine-3.17docker pull ghcr.io/fauust/docker-systemd:alpine-3.18docker pull ghcr.io/fauust/docker-systemd:alpine-3.19docker pull ghcr.io/fauust/docker-systemd:alpine-3.20docker pull ghcr.io/fauust/docker-systemd:alpine-3.21

Usage (docker)

For systemd to start, it is necessary to:

  • share the volume /sys/fs/cgroup with container (use read-only mode);
  • run the container in privileged mode.

You can also use podman that does not require it, see below.

docker run --name init-test --rm --privileged -d -v /sys/fs/cgroup:/sys/fs/cgroup:ro fauust/docker-systemd:debian-siddocker exec -it init-test bash
root@59c9e3e924e7:/# apt update && apt install procps
...
root@59c9e3e924e7:/# ps fax
    PID TTY      STAT   TIME COMMAND
     34 pts/0    Ss     0:00 bash
    420 pts/0    R+     0:00  \_ ps fax
      1 ?        Ss     0:00 /lib/systemd/systemd
     24 ?        Ss     0:00 /lib/systemd/systemd-journald

Usage (podman)

Podman is much more "systemd friendly", see https://developers.redhat.com/blog/2019/04/24/how-to-run-systemd-in-a-container/.

Here is how to use those containers with podman:

podman run --name init-test --rm -d fauust/docker-systemd:debian-sidpodman exec -it init-test bash
root@181cc7d48a8a:/# apt update && apt install procps
...
root@181cc7d48a8a:/# ps fax
    PID TTY      STAT   TIME COMMAND
     24 pts/0    Ss     0:00 bash
    859 pts/0    R+     0:00  \_ ps fax
      1 ?        Ss     0:00 /lib/systemd/systemd
     20 ?        Ss     0:00 /lib/systemd/systemd-journald

Notes

For testing purposes only, do not use in production!

About

Multi-arch docker containers for systemd testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 3

  •  
  •  
  •