From 958c9cfefc268d4d403b8a622f19cacdc39727c8 Mon Sep 17 00:00:00 2001 From: Renato Date: Mon, 27 Jul 2026 23:34:07 +0200 Subject: [PATCH] fix: DOCKER_CMD function instead of string for proper arg passing sg docker -c docker compose expands 'compose' as arg to sg, not docker. Replaced with bash function docker_cmd() that uses sudo docker as fallback. This works immediately after usermod without re-login. --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index db2ecb6..a087739 100755 --- a/install.sh +++ b/install.sh @@ -155,9 +155,9 @@ fi # Use sudo for docker commands if the current shell can't run docker directly if docker info &>/dev/null 2>&1; then - DOCKER_CMD="docker" + docker_cmd() { docker "$@"; } else - DOCKER_CMD="sg docker -c docker" + docker_cmd() { sudo docker "$@"; } fi # ── Clone / Pull ───────────────────────────────── @@ -193,22 +193,22 @@ log "Data directory ready" # ── Build & Start ──────────────────────────────── info "Building Docker image (this may take a few minutes)..." -$DOCKER_CMD compose build web +docker_cmd compose build web log "Build complete" info "Starting containers..." -$DOCKER_CMD compose up -d +docker_cmd compose up -d log "Containers are running" # ── Wait for health ────────────────────────────── info "Waiting for web service to be healthy..." for i in $(seq 1 30); do - if $DOCKER_CMD compose exec -T web wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/api/health &>/dev/null; then + if docker_cmd compose exec -T web wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/api/health &>/dev/null; then log "Web service is healthy" break fi if [ "$i" -eq 30 ]; then - warn "Timed out waiting for health check — check logs with: $DOCKER_CMD compose logs web" + warn "Timed out waiting for health check — check logs with: docker compose logs web" fi sleep 2 done