From 5d8f4c2505ad84a1c13f7a047d5a36c07d3f27a3 Mon Sep 17 00:00:00 2001 From: Patricia Grubel Date: Wed, 6 Sep 2023 10:51:28 -0600 Subject: [PATCH] PR #1699: fix docker check if docker is a wrapper for podman --- lib/base.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/base.sh b/lib/base.sh index 5da28d83e..821ceb19e 100644 --- a/lib/base.sh +++ b/lib/base.sh @@ -144,9 +144,15 @@ vset () { fi } - -# Do we need sudo to run docker? -if docker info > /dev/null 2>&1; then +# Is Docker present, and if so, do we need sudo? If docker is a wrapper for +# podman, “docker info” hangs (#1656), so treat that as not found. +if ( ! command -v docker > /dev/null 2>&1 ) \ + || ( docker --help 2>&1 | grep -Fqi podman ); then + docker_ () { + echo 'docker not found; unreachable code reached' 1>&1 + exit 1 + } +elif docker info > /dev/null 2>&1; then docker_ () { docker "$@" }