From a8dd69cf1777996873570448110239adba605a05 Mon Sep 17 00:00:00 2001 From: Gautam Divgi Date: Tue, 2 Apr 2019 11:11:21 -0500 Subject: [PATCH] Fixed cleanup-docker-orphans.sh to use docker-containerd-shim and containerd-shim (#4418) --- .../docker/files/cleanup-docker-orphans.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/container-engine/docker/files/cleanup-docker-orphans.sh b/roles/container-engine/docker/files/cleanup-docker-orphans.sh index 28f7205ab..2f12def43 100644 --- a/roles/container-engine/docker/files/cleanup-docker-orphans.sh +++ b/roles/container-engine/docker/files/cleanup-docker-orphans.sh @@ -9,12 +9,17 @@ list_descendants () [[ -n "$children" ]] && echo "$children" } -count_shim_processes=$(pgrep -f ^docker-containerd-shim | wc -l) +shim_search="^docker-containerd-shim" +count_shim_processes=$(pgrep -f $shim_search | wc -l) +if [ ${count_shim_processes} -eq 0 ]; then + shim_search="^containerd-shim" + count_shim_processes=$(pgrep -f $shim_search | wc -l) +fi if [ ${count_shim_processes} -gt 0 ]; then # Find all container pids from shims - orphans=$(pgrep -P $(pgrep -d ',' -f ^docker-containerd-shim) |\ + orphans=$(pgrep -P $(pgrep -d ',' -f $shim_search) |\ # Filter out valid docker pids, leaving the orphans egrep -v $(docker ps -q | xargs docker inspect --format '{{.State.Pid}}' | awk '{printf "%s%s",sep,$1; sep="|"}'))