Last active
February 5, 2022 20:13
-
-
Save jarek-przygodzki/802d9bbbe2f3d9b8fb5efd02d99e9619 to your computer and use it in GitHub Desktop.
CentOS8 systemd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:8 | |
# https://github.com/systemd/systemd/blob/v239/src/basic/virt.c#L443 | |
ENV container docker | |
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/*; | |
VOLUME [ "/sys/fs/cgroup" ] | |
RUN dnf install -y java-11-openjdk-headless | |
# RUN dnf install -y java-11-openjdk-devel | |
CMD ["/usr/sbin/init"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build | |
docker build --rm -f CentOS8-systemd-java.dockerfile -t jprzygodzki/centos-systemd-java11:8 . | |
# Run | |
docker run --rm -it --name c8-systemd -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v "WHERE_THE_RPMS_ARE:/rpms" --tmpfs /run jprzygodzki/centos-systemd-java11:8 | |
# Install | |
docker exec -it c8-systemd bash | |
cd /rpms | |
dnf install LIST-OF_RPMS | |
# Stop the container | |
docker stop -t0 c8-systemd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment