diff --git a/Dockerfile b/Dockerfile index 4f5673972c..0c0333d7de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,6 +67,9 @@ RUN set -euo pipefail; \ proc-sys-fs-binfmt_misc.mount || true; \ systemd-machine-id-setup || true +RUN set -euo pipefail; \ + systemctl mask getty.target console-getty.service getty-static.service getty@.service + ENV container=docker STOPSIGNAL SIGRTMIN+3 diff --git a/roles/web-app-docs/files/test/Dockerfile b/roles/web-app-docs/files/test/Dockerfile index 3fe1cf46bb..e952978e6b 100644 --- a/roles/web-app-docs/files/test/Dockerfile +++ b/roles/web-app-docs/files/test/Dockerfile @@ -4,4 +4,7 @@ FROM ${MACHINE_BASE_IMAGE} COPY init.sh /tmp/docs-guide-init.sh RUN /bin/sh /tmp/docs-guide-init.sh && rm -f /tmp/docs-guide-init.sh +ENV container=docker +STOPSIGNAL SIGRTMIN+3 + ENTRYPOINT ["/sbin/init"] diff --git a/roles/web-app-docs/files/test/init.sh b/roles/web-app-docs/files/test/init.sh index 3b5bd176f0..1907caf44d 100644 --- a/roles/web-app-docs/files/test/init.sh +++ b/roles/web-app-docs/files/test/init.sh @@ -6,7 +6,14 @@ set -e -[ -e /sbin/init ] && exit 0 +mask_units_that_escape_the_container() { + systemctl mask getty.target console-getty.service getty-static.service getty@.service tmp.mount +} + +if [ -e /sbin/init ]; then + mask_units_that_escape_the_container + exit 0 +fi APT_OPTS="-o Acquire::Retries=5 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30" @@ -31,3 +38,4 @@ fi grep -q myhostname /etc/nsswitch.conf || sed -i "s/^hosts:.*/& myhostname/" /etc/nsswitch.conf [ -e /sbin/init ] || ln -sf /lib/systemd/systemd /sbin/init +mask_units_that_escape_the_container diff --git a/roles/web-app-matrix/files/flavor/ansible/runner/Dockerfile b/roles/web-app-matrix/files/flavor/ansible/runner/Dockerfile index 21e8583a2d..b8f1959298 100644 --- a/roles/web-app-matrix/files/flavor/ansible/runner/Dockerfile +++ b/roles/web-app-matrix/files/flavor/ansible/runner/Dockerfile @@ -49,6 +49,7 @@ RUN systemctl mask \ kmod-static-nodes.service \ console-getty.service \ getty.target \ + getty-static.service \ getty@.service RUN python3 -m venv "$VIRTUAL_ENV" \