https://bugzilla.redhat.com/show_bug.cgi?id=1033604
--- Comment #1 from Michal Fojtik mfojtik@redhat.com --- https://github.com/dotcloud/docker/issues/2296
There is another issue reported on Github with the same problem. The solution as far as I understand is to use Fedora 'machine' container, in other words start the systemd service in Dockerfile?
So if I want to build a Docker container built on top of Fedora 20 image, I created this Dockerfile (I might be completely wrong on this ;-)
FROM mattdm/fedora RUN yum install -y redis RUN systemctl enable redis.service RUN /usr/lib/systemd/systemd --system & EXPOSE 6379 ENTRYPOINT ["/usr/bin/redis-cli"]
I wonder about this line:
RUN /usr/lib/systemd/systemd --system &
If I do this inside the container, it starts systemd deamon and some services seems to start as well:
[root@localhost redis-server]# docker run -i -t 275d2bce86d7 /bin/bash
bash-4.2# systemctl start redis.service Failed to get D-Bus connection: No connection to service manager.
bash-4.2# /usr/lib/systemd/systemd --system & [1] 7 bash-4.2# systemd 204 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ) Detected virtualization 'lxc'. Failed to set hostname to <41a78414b3fd>: Operation not permitted No control group support available, not creating root group. Failed to open /dev/autofs: No such file or directory Failed to initialize automounter: No such file or directory ... ...more logs...
bash-4.2# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 11732 1652 ? S 20:24 0:00 /bin/bash root 7 0.2 0.1 46156 3380 ? S 20:25 0:00 /usr/lib/systemd/systemd --system redis 40 0.0 0.3 46576 7548 ? Ssl 20:25 0:00 /usr/sbin/redis-server /etc/redis.conf root 47 0.0 0.0 124096 1496 ? Ss 20:25 0:00 /usr/sbin/crond -n root 48 0.0 0.0 110000 824 tty1 Ss+ 20:25 0:00 /sbin/agetty --noclear -s console 115200 38400 9600 root 62 0.0 0.1 83620 3708 ? Ss 20:25 0:00 /usr/sbin/sendmail -bd -q1h root 64 0.0 0.0 11264 1040 ? R+ 20:25 0:00 ps aux
And also Redis is here! (Because I enabled it in one of the RUN commands). I wonder, if this is the right way to build Fedora based Docker containers, or if it is documented somewhere.