From 9b8712237c3a50a5eaca05174f819fa1971c78f0 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Tue, 8 Jul 2025 00:50:53 +0900 Subject: [PATCH] Fix port 80 already in use error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add port 80 usage detection with netstat and docker ps - Stop and remove containers using port 80 before deployment - Ensures clean port 80 for nginx service - Prevents 'bind: address already in use' errors 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/deploy.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b6fcca3..bb463e3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -89,7 +89,16 @@ jobs: echo "Deployed to $DEPLOY; backup saved at $BACKUP" - # 5) docker-compose 재시작 + # 5) 포트 80 사용 중인 컨테이너 정리 + echo "Checking port 80 usage..." + netstat -tlnp | grep :80 || true + docker ps --format "table {{.Names}}\t{{.Ports}}" | grep ":80" || true + + # 포트 80 사용하는 모든 컨테이너 정지 + docker ps --filter "publish=80" -q | xargs -r docker stop + docker ps -a --filter "publish=80" -q | xargs -r docker rm + + # 6) docker-compose 재시작 cd "$DEPLOY" docker-compose down 2>/dev/null || true docker-compose up -d --build