From 8baa881aab85f8398d2edbbcc0da4bd1f556dd98 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 20 Jul 2021 12:28:49 -0700 Subject: [PATCH] Add (hopefully temporary) workaround for containerd-shim zombies --- 19.03-rc/dind/dockerd-entrypoint.sh | 5 +++++ 19.03/dind/dockerd-entrypoint.sh | 5 +++++ 20.10-rc/dind/dockerd-entrypoint.sh | 5 +++++ 20.10/dind/dockerd-entrypoint.sh | 5 +++++ dockerd-entrypoint.sh | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/19.03-rc/dind/dockerd-entrypoint.sh b/19.03-rc/dind/dockerd-entrypoint.sh index d5f59fa9e..1f5625b57 100755 --- a/19.03-rc/dind/dockerd-entrypoint.sh +++ b/19.03-rc/dind/dockerd-entrypoint.sh @@ -138,6 +138,11 @@ if [ "$1" = 'dockerd' ]; then # explicitly remove Docker's default PID file to ensure that it can start properly if it was stopped uncleanly (and thus didn't clean up the PID file) find /run /var/run -iname 'docker*.pid' -delete || : + if dockerd --version | grep -qF ' 20.10.'; then + # XXX inject "docker-init" (tini) as pid1 to workaround https://github.com/docker-library/docker/issues/318 (zombie container-shim processes) + set -- docker-init -- "$@" + fi + uid="$(id -u)" if [ "$uid" != '0' ]; then # if we're not root, we must be trying to run rootless diff --git a/19.03/dind/dockerd-entrypoint.sh b/19.03/dind/dockerd-entrypoint.sh index d5f59fa9e..1f5625b57 100755 --- a/19.03/dind/dockerd-entrypoint.sh +++ b/19.03/dind/dockerd-entrypoint.sh @@ -138,6 +138,11 @@ if [ "$1" = 'dockerd' ]; then # explicitly remove Docker's default PID file to ensure that it can start properly if it was stopped uncleanly (and thus didn't clean up the PID file) find /run /var/run -iname 'docker*.pid' -delete || : + if dockerd --version | grep -qF ' 20.10.'; then + # XXX inject "docker-init" (tini) as pid1 to workaround https://github.com/docker-library/docker/issues/318 (zombie container-shim processes) + set -- docker-init -- "$@" + fi + uid="$(id -u)" if [ "$uid" != '0' ]; then # if we're not root, we must be trying to run rootless diff --git a/20.10-rc/dind/dockerd-entrypoint.sh b/20.10-rc/dind/dockerd-entrypoint.sh index d5f59fa9e..1f5625b57 100755 --- a/20.10-rc/dind/dockerd-entrypoint.sh +++ b/20.10-rc/dind/dockerd-entrypoint.sh @@ -138,6 +138,11 @@ if [ "$1" = 'dockerd' ]; then # explicitly remove Docker's default PID file to ensure that it can start properly if it was stopped uncleanly (and thus didn't clean up the PID file) find /run /var/run -iname 'docker*.pid' -delete || : + if dockerd --version | grep -qF ' 20.10.'; then + # XXX inject "docker-init" (tini) as pid1 to workaround https://github.com/docker-library/docker/issues/318 (zombie container-shim processes) + set -- docker-init -- "$@" + fi + uid="$(id -u)" if [ "$uid" != '0' ]; then # if we're not root, we must be trying to run rootless diff --git a/20.10/dind/dockerd-entrypoint.sh b/20.10/dind/dockerd-entrypoint.sh index d5f59fa9e..1f5625b57 100755 --- a/20.10/dind/dockerd-entrypoint.sh +++ b/20.10/dind/dockerd-entrypoint.sh @@ -138,6 +138,11 @@ if [ "$1" = 'dockerd' ]; then # explicitly remove Docker's default PID file to ensure that it can start properly if it was stopped uncleanly (and thus didn't clean up the PID file) find /run /var/run -iname 'docker*.pid' -delete || : + if dockerd --version | grep -qF ' 20.10.'; then + # XXX inject "docker-init" (tini) as pid1 to workaround https://github.com/docker-library/docker/issues/318 (zombie container-shim processes) + set -- docker-init -- "$@" + fi + uid="$(id -u)" if [ "$uid" != '0' ]; then # if we're not root, we must be trying to run rootless diff --git a/dockerd-entrypoint.sh b/dockerd-entrypoint.sh index d5f59fa9e..1f5625b57 100755 --- a/dockerd-entrypoint.sh +++ b/dockerd-entrypoint.sh @@ -138,6 +138,11 @@ if [ "$1" = 'dockerd' ]; then # explicitly remove Docker's default PID file to ensure that it can start properly if it was stopped uncleanly (and thus didn't clean up the PID file) find /run /var/run -iname 'docker*.pid' -delete || : + if dockerd --version | grep -qF ' 20.10.'; then + # XXX inject "docker-init" (tini) as pid1 to workaround https://github.com/docker-library/docker/issues/318 (zombie container-shim processes) + set -- docker-init -- "$@" + fi + uid="$(id -u)" if [ "$uid" != '0' ]; then # if we're not root, we must be trying to run rootless