From f209880fd00156f0a65a36b10b21436e9ae97c4f Mon Sep 17 00:00:00 2001 From: Thomas Faour Date: Sat, 1 Aug 2026 12:05:58 +0000 Subject: [PATCH] Deploy: kill anything holding port 8420 before bringing the new container up "docker compose down" before "pull/up" (previous commit) didn't fix the port conflict -- it only tears down containers this compose project itself tracks, so a stale/orphaned container from an earlier deploy (or anything else bound to 8420, especially with restart: unless-stopped fighting back) slips through untouched and the new "up" fails with "port is already allocated". This is root-cause-agnostic instead: find and stop/remove *any* container publishing 8420, compose-managed or not, right before pull/up. --remove-orphans on the down step too, for services that used to be in the compose file and aren't anymore. --- .gitea/workflows/server-docker-build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/server-docker-build.yml b/.gitea/workflows/server-docker-build.yml index 19c1c76..96b1d0c 100644 --- a/.gitea/workflows/server-docker-build.yml +++ b/.gitea/workflows/server-docker-build.yml @@ -69,4 +69,9 @@ jobs: ssh-keyscan -p "$DEPLOY_PORT" "$DEPLOY_HOST" >> ~/.ssh/known_hosts 2>/dev/null ssh -i ~/.ssh/deploy_key -p "$DEPLOY_PORT" -o StrictHostKeyChecking=yes \ espressoframe_deployer@"$DEPLOY_HOST" \ - 'cd ~/espresso-frame && docker compose down && docker compose pull && docker compose up -d' + 'cd ~/espresso-frame && \ + docker compose down --remove-orphans && \ + docker ps -q --filter publish=8420 | xargs -r docker stop && \ + docker ps -aq --filter publish=8420 | xargs -r docker rm && \ + docker compose pull && \ + docker compose up -d'