|
| 1 | +FROM oraclelinux:9 |
| 2 | +LABEL maintainer="Thorsten Bruhns" |
| 3 | +# Original code is copied from: |
| 4 | +# https://raw.githubusercontent.com/geerlingguy/docker-ubi8-ansible/master/Dockerfile |
| 5 | +# |
| 6 | +ENV container=docker |
| 7 | + |
| 8 | +ENV pip_packages "ansible" |
| 9 | + |
| 10 | +# Silence annoying subscription messages. |
| 11 | +RUN echo "enabled=0" >> /etc/yum/pluginconf.d/subscription-manager.conf |
| 12 | + |
| 13 | +# Install systemd -- See https://hub.docker.com/_/centos/ |
| 14 | +RUN yum -y update; yum clean all; \ |
| 15 | +(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ |
| 16 | +rm -f /lib/systemd/system/multi-user.target.wants/*;\ |
| 17 | +rm -f /etc/systemd/system/*.wants/*;\ |
| 18 | +rm -f /lib/systemd/system/local-fs.target.wants/*; \ |
| 19 | +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ |
| 20 | +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ |
| 21 | +rm -f /lib/systemd/system/basic.target.wants/*;\ |
| 22 | +rm -f /lib/systemd/system/anaconda.target.wants/*; |
| 23 | + |
| 24 | +# Install requirements. |
| 25 | +RUN yum makecache --timer \ |
| 26 | + && yum -y install initscripts \ |
| 27 | + && yum -y update \ |
| 28 | + && yum -y install \ |
| 29 | + sudo \ |
| 30 | + which \ |
| 31 | + hostname \ |
| 32 | + python3 \ |
| 33 | + python3-pip \ |
| 34 | + && yum clean all |
| 35 | + |
| 36 | +# Install Ansible via Pip. |
| 37 | +RUN pip3 install --upgrade pip \ |
| 38 | + && pip3 install $pip_packages |
| 39 | + |
| 40 | +# Disable requiretty. |
| 41 | +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers |
| 42 | + |
| 43 | +# Install Ansible inventory file. |
| 44 | +RUN mkdir -p /etc/ansible |
| 45 | +RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts |
| 46 | + |
| 47 | +VOLUME ["/sys/fs/cgroup"] |
| 48 | +CMD ["/usr/lib/systemd/systemd"] |
0 commit comments