openrc under docker container takes too long time to start services
openrc worked fine with Fedora 38's moby-engine. From Fedora 39, openrc requires very long time to start network services such as postgresql, apache, sshd, etc. I've tried docker-ce, but it doesn't work even with Fedora 38.
Reproducing Dockerfile:
FROM alpine:3.17
RUN \
apk add openrc mdevd logrotate bash && \
apk add openssh-client openssh-server postgresql apache2
# apk add openrc busybox-initscripts logrotate bash && \
RUN \
rc-update add local && \
rc-update add apache2 && \
rc-update add postgresql && \
rc-update add sshd
RUN \
sed -e 's/^tty/#tty/g' < /etc/inittab > /tmp/inittab && \
mv /tmp/inittab /etc/inittab
RUN \
echo 'rc_sys="docker"' >> /etc/rc.conf; \
echo 'rc_controller_cgroups="NO"' >> /etc/rc.conf; \
echo 'rc_cgroup_mode="unified"' >> /etc/rc.conf;
RUN \
apk --no-cache update
CMD /sbin/init
Build and test script: (It takes very very long time to start up services, but services are started successfully. strace shows "start-stop-daemon" waits something on poll system call)
#!/usr/bin/env bash
docker build -t alpine-openrc-test . || exit 255
docker run --mount type=tmpfs,tmpfs-size=1024M,destination=/tmp --mount type=tmpfs,tmpfs-size=256M,destination=/run --privileged --cgroupns=host -v /sys/fs/cgroup:/sys/fs/cgroup:rw --rm --name alpine-openrc-test alpine-openrc-test
docker-info output:
Client: Docker Engine - Community
Version: 24.0.7
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.2
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.21.0
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 10
Running: 10
Paused: 0
Stopped: 0
Images: 1709
Server Version: 24.0.7
Storage Driver: zfs
Zpool: datastore
Zpool Health: ONLINE
Parent Dataset: datastore/docker
Space Used By Parent: 125728694080
Space Available: 7917737652896
Parent Quota: no
Compression: lz4
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
runc version: v1.1.9-0-gccaecfc
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.5.10-300.fc39.x86_64
Operating System: Fedora Linux 39 (Workstation Edition)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 62.58GiB
Name: dev.inter.es-i.jp
ID: 87ad3282-8a7c-48a0-ab48-56fb21ce48ea
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: yohgaki
Experimental: false
Insecure Registries:
docker.inter.es-i.jp:5000
127.0.0.0/8
Live Restore Enabled: false