umount openshift local volumes in clean up script
add sudo
directly use container name for stoping docker container
backoff
optimize docker ps
add sudo to docker command
use grep
#!/bin/sh
echo "Killing openshift all-in-one server ..."
-pkill -x openshift
+sudo pkill -x openshift
+
+echo "Stopping all k8s docker containers on host ..."
+sudo docker ps --format='{{.Names}}' | grep -E '^k8s_' | xargs -l -r sudo docker stop
+
+echo "Unmounting openshift local volumes ..."
+mount | grep "openshift.local.volumes" | awk '{ print $3}' | xargs -l -r sudo umount
echo "Cleaning up openshift runtime files ..."
-rm -rf openshift.local.*
+sudo rm -rf openshift.local.*
+
-echo "Stopping all k8s docker containers on host ..."
-docker ps | awk 'index($NF,"k8s_")==1 { print $1 }' | xargs -l -r docker stop
