Skip to content
Snippets Groups Projects
Commit a8dd69cf authored by Gautam Divgi's avatar Gautam Divgi Committed by Kubernetes Prow Robot
Browse files

Fixed cleanup-docker-orphans.sh to use docker-containerd-shim and containerd-shim (#4418)

parent 4fe2aa6b
No related branches found
No related tags found
No related merge requests found
...@@ -9,12 +9,17 @@ list_descendants () ...@@ -9,12 +9,17 @@ list_descendants ()
[[ -n "$children" ]] && echo "$children" [[ -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 if [ ${count_shim_processes} -gt 0 ]; then
# Find all container pids from shims # 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 # 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="|"}')) egrep -v $(docker ps -q | xargs docker inspect --format '{{.State.Pid}}' | awk '{printf "%s%s",sep,$1; sep="|"}'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment