Skip to content

Commit cf1f72f

Browse files
committed
Addressing crashing hosts when developing docker containers.
See geerlingguy/docker-ubuntu1804-ansible#12
1 parent f71120c commit cf1f72f

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ devmaster_id_rsa.pub
2424
bin/*
2525
~bin/devshop
2626
!bin/branch-or-tag
27-
!bin/docker-entrypoint
27+
!bin/docker*
2828
!bin/hosting-queue-runner
2929
!bin/mysql-wait
3030

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ RUN chmod 766 $DEVSHOP_TESTS_ASSETS_PATH
7373

7474
RUN ansible --version
7575

76+
# Cleanup unwanted systemd files. See bin/docker-systemd-clean.
77+
RUN docker-systemd-clean
78+
7679
# Remove Home Directory if desired so that devshop code is reinstalled.
7780
RUN if [ $DEVSHOP_REBUILD_HOME ]; then rm -rf /var/aegir; fi
7881

bin/docker-systemd-clean

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
devshop-logo "Cleaning up SystemD"
5+
echo "This should only be run inside a container with SystemD."
6+
echo "See https://github.com/geerlingguy/docker-ubuntu1804-ansible/pull/12"
7+
8+
# @TODO: Make this multi-os, and determine if there are any unwanted side effects.
9+
# The "ls" command should fail, breaking any build without this path.
10+
ls -la /lib/systemd
11+
12+
find /lib/systemd/system/sysinit.target.wants/* ! -name systemd-tmpfiles-setup.service -delete;
13+
rm -f /lib/systemd/system/multi-user.target.wants/*;
14+
rm -f /etc/systemd/system/*.wants/*;
15+
rm -f /lib/systemd/system/local-fs.target.wants/*;
16+
rm -f /lib/systemd/system/sockets.target.wants/*udev*;
17+
rm -f /lib/systemd/system/sockets.target.wants/*initctl*;
18+
rm -f /lib/systemd/system/basic.target.wants/*;
19+
rm -f /lib/systemd/system/anaconda.target.wants/*;find /lib/systemd/system/sysinit.target.wants/* ! -name systemd-tmpfiles-setup.service -delete;

0 commit comments

Comments
 (0)