diff --git a/etc/init.d/proxysql b/etc/init.d/proxysql index dbaf010861..211df12917 100755 --- a/etc/init.d/proxysql +++ b/etc/init.d/proxysql @@ -60,11 +60,17 @@ testpid() { } is_pid_child_of_docker() { + # Check if docker is installed (no point in checking if docker isn't present) which docker &> /dev/null if [ "$?" -eq 1 ] ; then return 0; fi + # Check if any docker containers are running (check required since empty output fails next command) + if [ "$(docker ps -q | wc -l)" -eq 0 ] ; then + return 0; + fi + IFS=$'\n' docker_pids=($(docker ps -q | xargs docker inspect --format '{{.State.Pid}}')) local child_pid=$1