Skip to content

Instantly share code, notes, and snippets.

@qjoly
Created April 9, 2024 09:59
Show Gist options
  • Save qjoly/8fed37bdc77a23e61b495b6fb0f8290f to your computer and use it in GitHub Desktop.
Save qjoly/8fed37bdc77a23e61b495b6fb0f8290f to your computer and use it in GitHub Desktop.
Systemd Centos Image
version: '3.8'
services:
rockylinux:
privileged: true
build:
context: .
dockerfile: Dockerfile
image: rockylinux-9-systemd
cgroup: host
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
container_name: rockylinux
FROM rockylinux/rockylinux:9
ENV HTTP_PROXY "http://proxy.infra.dgfip:3128"
ENV HTTPS_PROXY "http://proxy.infra.dgfip:3128"
RUN [ ! -f /usr/sbin/init ] && dnf -y install systemd;
RUN ([ -d /lib/systemd/system/sysinit.target.wants ] && 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/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment