j8r / dockerfiles

Repository for my dockerfiles
https://hub.docker.com/u/jrei
ISC License
123 stars 46 forks source link

Fedora systemd docker won't start. (LoL I spoke to soon) ... #16

Open nmvega opened 3 years ago

nmvega commented 3 years ago

Hi Friend:

I've successfully used your Dockerfile before, and it works well. I was tinkering with it today, and for some reason it doesn't launch.

I pasted my session below:

user@fedora-33$ cat Dockerfile
======================================
FROM fedora:latest

ENV container docker

RUN dnf -y update \
    && dnf -y install systemd \
    && dnf clean all

RUN cd /lib/systemd/system/sysinit.target.wants/; \
    for i in *; do [ $i = systemd-tmpfiles-setup.service ] || rm -f $i; done

RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
    /etc/systemd/system/*.wants/* \
    /lib/systemd/system/local-fs.target.wants/* \
    /lib/systemd/system/sockets.target.wants/*udev* \
    /lib/systemd/system/sockets.target.wants/*initctl* \
    /lib/systemd/system/basic.target.wants/* \
    /lib/systemd/system/anaconda.target.wants/*

VOLUME [ "/sys/fs/cgroup" ]

CMD ["/usr/sbin/init"]
======================================

user@fedora-33$ docker run -d --name systemd-fedora --tmpfs /tmp \
                   --tmpfs /run --tmpfs /run/lock \
                   -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
                   jrei/systemd-fedora

user@fedora-33$ docker images
REPOSITORY            TAG       IMAGE ID       CREATED       SIZE
jrei/systemd-fedora   latest    30627080674c   6 weeks ago   224MB

user@fedora-33$ docker run -d --name systemd-fedora --tmpfs /tmp \
                   --tmpfs /run --tmpfs /run/lock \
                   -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
                   jrei/systemd-fedora

user@fedora-33$ docker ps -a
CONTAINER ID   IMAGE                 COMMAND            CREATED          STATUS                       PORTS     NAMES
e6715541e20f   jrei/systemd-fedora   "/usr/sbin/init"   10 seconds ago   Exited (255) 9 seconds ago             systemd-fedora

Just FYI (not urgent). :blush:

j8r commented 3 years ago

I just tried, no issues on my side:

CONTAINER ID  IMAGE                                 COMMAND         CREATED         STATUS             PORTS   NAMES
b12c49193c2d  docker.io/jrei/systemd-fedora:latest  /usr/sbin/init  36 seconds ago  Up 36 seconds ago          systemd-fedora

As said in the README.md instructions, try also docker run -d --name systemd-fedora --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro jrei/systemd-fedora.

Being in Fedora, look also at SELinux.

I can't reproduce, so you'll have to figure out the actual error.

nmvega commented 3 years ago

@j8r Yeah, I had already tried both command variations. Also, disabling SELinux is the first thing I do on all my Fedora O/Ss. :smile: I'll play with it more to see. It's odd, because I used this base specification a million times. I'll let you know. Thanks!