Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Systemd files and add Travis-CI test for Systemd (Rebased) #18

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ script:

# Verify Ansible is available in the container.
- docker exec --tty test-container env TERM=xterm ansible --version

# Verify that Systemd is working
- docker exec --tty test-container env TERM=xterm sh -c 'systemctl status --no-pager'
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ RUN sed -i 's/^\($ModLoad imklog\)/#\1/' /etc/rsyslog.conf
# Fix potential UTF-8 errors with ansible-test.
RUN locale-gen en_US.UTF-8

# Cleanup unwanted systemd files
# See https://hub.docker.com/_/centos/ and https://github.com/ansible/molecule/issues/1104
RUN find /lib/systemd/system/sysinit.target.wants/* ! -name systemd-tmpfiles-setup.service -delete; \
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/*; \
rm -f /lib/systemd/system/systemd*udev*; \
rm -f /lib/systemd/system/getty.target
Copy link

@vincent-legoll vincent-legoll May 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the multiple rms ?
There are also whitespace inconsistencies ;-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just a rebase of #12 where they explained those files need to be removed to fix problems with systemd in a container running in a systemd system. The biggest problem is the container causes the container to log the user of the host out when it stops. Why multiple rms instead of a single rm. No real reason I was just rebasing the pull because @geerlingguy asked the original guy to rebase but the original guy wasn't responding. Same goes for the whitespace inconsistency.


# Install Ansible via Pip.
RUN pip3 install $pip_packages

Expand All @@ -30,10 +43,5 @@ RUN chmod +x initctl_faker && rm -fr /sbin/initctl && ln -s /initctl_faker /sbin
RUN mkdir -p /etc/ansible
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts

# Remove unnecessary getty and udev targets that result in high CPU usage when using
# multiple containers with Molecule (https://github.com/ansible/molecule/issues/1104)
RUN rm -f /lib/systemd/system/systemd*udev* \
&& rm -f /lib/systemd/system/getty.target

VOLUME ["/sys/fs/cgroup", "/tmp", "/run"]
CMD ["/lib/systemd/systemd"]