Skip to content

Support running systemd in a container #2784

@sazzy4o

Description

@sazzy4o

What is the problem you're trying to solve

nerdctl does not currently support running systemd inside containers

Systemd needs specific mounts:

$ sudo nerdctl run --rm -it registry.hub.docker.com/sazzy4o/build:systemd
Failed to mount tmpfs at /run: Operation not permitted
[!!!!!!] Failed to mount API filesystems.
Exiting PID 1...

And needs cgroup mount to be writeable:

$ sudo nerdctl run --tmpfs /run --rm -it registry.hub.docker.com/sazzy4o/build:systemd
systemd v246.15-1.fc33 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified)
Detected virtualization container-other.
Detected architecture x86-64.

Welcome to Fedora 33 (Container Image)!

Set hostname to <b75c4d83f324>.
Failed to create /init.scope control group: Read-only file system
Failed to allocate manager object: Read-only file system
[!!!!!!] Failed to allocate manager object.
Exiting PID 1...

systemd would be useful to run for kata containers:
kata-containers/kata-containers#8470
kata-containers/kata-containers#7357
(For running applications that need systemd)

Describe the solution you'd like

Supporting a --systemd flag similar to podman

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions