projectatomic / oci-systemd-hook

OCI hook to enable running systemd in a container
GNU General Public License v3.0
64 stars 26 forks source link

Failed to run /sbin/init in a container following fedora wiki instructions #93

Open peterbaouoft opened 6 years ago

peterbaouoft commented 6 years ago

Hi, I was recently searching for running systemd in a docker container, and I have found systemd-containers on fedora wiki. I followed the instructions but got the following output:

[root@localhost Dockertest]# docker run -ti --tmpfs /run --tmpfs /tmp -v /sys/fs/cgroup:/sys/fs/cgroup:ro fedora:systemd                                                                                          
systemd 238 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
Detected virtualization container-other.
Detected architecture x86-64.

Welcome to Fedora 28 (Twenty Eight)!

Set hostname to <1417cece4bd8>.
Initializing machine ID from random generator.
Failed to create /system.slice/docker-1417cece4bd88d245ef53de8f422f07fffcd2cd50dba0a069b0464a333a92829.scope/init.scope control group: Permission denied                                                          
Failed to allocate manager object: Permission denied
[!!!!!!] Failed to allocate manager object, freezing.
Freezing execution

My system is a fedora 28 VM, my docker version is docker-1.13.1-51.git4032bd5.fc28.x86_64, and the dockerfile used to build is,

FROM registry.fedoraproject.org/fedora:28
ENV container=oci
RUN dnf -y install httpd; dnf clean all; systemctl enable httpd
STOPSIGNAL SIGRTMIN+3
EXPOSE 80
CMD [ "/sbin/init" ]

I also saw a similar error on https://bugzilla.redhat.com/show_bug.cgi?id=1402264, but I did not install oci-systemd-hook at all on my host. Any suggestions for how to approach/fix the problem? Thanks =).