Dockerfile.centos-7 1.0 KB

123456789101112131415161718192021222324252627
  1. FROM centos:7
  2. # Install systemd -- See https://hub.docker.com/_/centos/
  3. RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs
  4. RUN yum -y update; yum clean all; \
  5. (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
  6. rm -f /lib/systemd/system/multi-user.target.wants/*; \
  7. rm -f /etc/systemd/system/*.wants/*; \
  8. rm -f /lib/systemd/system/local-fs.target.wants/*; \
  9. rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
  10. rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
  11. rm -f /lib/systemd/system/basic.target.wants/*; \
  12. rm -f /lib/systemd/system/anaconda.target.wants/*;
  13. # Install Ansible
  14. RUN yum -y install epel-release
  15. RUN yum -y install git ansible sudo
  16. RUN yum clean all
  17. # Disable requiretty
  18. RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
  19. # Install Ansible inventory file
  20. RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts
  21. VOLUME ["/sys/fs/cgroup"]
  22. CMD ["/usr/sbin/init"]