From e4ad440c154858ce18e5c0f0aa3c64eac034e9f0 Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Tue, 2 Jun 2026 01:59:16 +0330 Subject: [PATCH] fix(ci): stop & remove old container before deploying new one docker compose up --force-recreate only works when Compose owns the container. If the container was started outside Compose (e.g. manually via docker restart), Compose can't recreate it and errors with "container name already in use". Explicitly stopping and removing it first handles both cases cleanly. Co-Authored-By: Claude Sonnet 4.5 --- .gitea/workflows/ci-cd.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index fe7d2c9..fc38c2a 100644 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -91,7 +91,10 @@ jobs: DOCKER_BUILDKIT: 1 - name: Deploy - run: docker compose up -d --no-deps --force-recreate api + run: | + docker stop drsousan_api 2>/dev/null || true + docker rm drsousan_api 2>/dev/null || true + docker compose up -d --no-deps api - name: Wait for healthy run: |