Skip to content

Instantly share code, notes, and snippets.

@mrlesmithjr
Created November 18, 2021 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrlesmithjr/e9cee7f12184c61df6e242d21f5bdd6c to your computer and use it in GitHub Desktop.
Save mrlesmithjr/e9cee7f12184c61df6e242d21f5bdd6c to your computer and use it in GitHub Desktop.
FROM {{ item.image }}
ENV container docker
{% if 'centos' in item.image %}
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/*;
RUN yum install -y epel-release python3 sudo
CMD ["/usr/sbin/init"]
{% elif 'debian' in item.image or 'ubuntu' in item.image %}
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 sudo systemd
CMD ["/lib/systemd/systemd"]
{% endif %}
VOLUME ["/sys/fs/cgroup", "/tmp", "/run"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment