You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@drystone as spoken, here's how you enable systemd in a CentOS container.
FROM centos
ENV container docker
# Update yum repos
RUN yum clean expire-cache && yum install -y yum-utils deltarpm && yum upgrade -y
# yum fails on checksums if built on docker host based on overlayfs
# https://github.com/docker/docker/issues/10180
RUN yum install -y yum-plugin-ovl
# elinks and screen for convenience
RUN yum install -y curl sudo tar hostname iproute secure-delete \
elinks screen \
&& yum clean all
# From https://hub.docker.com/_/centos/
# Dockerfile for systemd base image
# Systemd is now included in both the centos:7 and centos:latest base
# containers, but it is not active by default. In order to use systemd, you
# will need to include text similar to the example Dockerfile below.
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; \
do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
# We may also want to remove systemd-update-utmp to remove the failures about it
# rm -f /lib/systemd/system/systemd-update-utmp*; \
# FIXME: A RedHat guy's workaround
# https://vpavlin.eu/2015/02/fedora-docker-and-systemd/
# And also from here
RUN systemctl mask systemd-remount-fs.service dev-hugepages.mount \
sys-fs-fuse-connections.mount systemd-logind.service getty.target \
console-getty.service
# Unnecessary to mask
# sys-kernel-config.mount sys-kernel-debug.mount systemd-udevd.service
RUN cp /usr/lib/systemd/system/dbus.service /etc/systemd/system/; \
sed -i 's/OOMScoreAdjust=-900//' /etc/systemd/system/dbus.service
VOLUME ["/sys/fs/cgroup"]
ENTRYPOINT ["/usr/sbin/init"]
The text was updated successfully, but these errors were encountered:
@drystone as spoken, here's how you enable
systemd
in a CentOS container.The text was updated successfully, but these errors were encountered: