[systemd-devel] Connect /usr/bin/init to docker container's STDOUT/STDIN

Lennart Poettering lennart at poettering.net
Fri Sep 30 13:16:31 UTC 2022


On Do, 29.09.22 19:42, Nicola Mori (nicolamori at aol.com) wrote:

> So I believe this problem might have been introduced by a systemd version
> subsequent to 219 and that hopefully it might be fixed somehow by means of
> e.g. proper configuration of the container/environment, but I need some
> advice about what to do since I'm clueless.

Docker is explicitly anti-systemd, you'll always having a hard time
making this work.

Note that since a longer time we'll close /dev/console in PID 1
whenever we can, and only open it immediately before printing stuff to
the console, for compatibility with the kernel's SAK feature which
otherwise would kill PID 1 if SAK is hit.

Thus you really need to pass a proper pty into the container as
/dev/console, if you want systemd to run inside it.

We documented our expectations clearly here:

https://systemd.io/CONTAINER_INTERFACE

Pretty much all container managers implement this more or less. Just
Docker does not...

You might be able to replace docker with podman, where supposed all
this just works out of the box.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list