From e167f98370c04cc0eef271e7dd78867dc3991349 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 28 Jun 2026 14:37:03 +0000 Subject: [PATCH] common.sh: fall back to /usr/bin/docker when PATH is restricted under sudo command -v may miss the binary if sudo stripped PATH; check the canonical apt install location directly as a fallback before reporting failure, and use the same fallback when printing the installed version. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01LQJBvqzXeyuhhAcAA3Q5Wq --- lib/common.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/common.sh b/lib/common.sh index c6a00bb..89851cb 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -184,7 +184,9 @@ require_docker() { return 1 fi - if ! command -v docker &>/dev/null; then + # command -v may miss the binary if PATH is restricted under sudo; check + # the canonical apt install location as a fallback before giving up. + if ! command -v docker &>/dev/null && ! [ -x /usr/bin/docker ]; then log_error "Docker binary not found after install — something went wrong." return 1 fi @@ -194,7 +196,9 @@ require_docker() { && log_info "Added $ACTUAL_USER to the docker group (re-login or run 'newgrp docker' to activate)" fi - log_success "Docker installed ($(docker --version 2>/dev/null))" + local _docker_bin + _docker_bin="$(command -v docker 2>/dev/null || echo /usr/bin/docker)" + log_success "Docker installed ($("$_docker_bin" --version 2>/dev/null))" } # ── Command execution honoring dry-run ───────────────────────────────────────