fix: add aggressive cleanup before deploying
Stop container, disconnect from networks, then redeploy to avoid 'Container cannot be connected to network endpoints' error.
This commit is contained in:
@@ -64,15 +64,18 @@ jobs:
|
||||
|
||||
cd /volume1/docker/nas-dashboard
|
||||
|
||||
# Clean up any legacy manual containers
|
||||
# Stop and remove any existing container
|
||||
docker compose -f docker-compose.dev.yml -p nas-dashboard-dev down --remove-orphans || true
|
||||
docker rm -f nas-dashboard-dev 2>/dev/null || true
|
||||
|
||||
# Disconnect from networks if still connected
|
||||
docker network disconnect nas-dashboard_internal nas-dashboard-dev 2>/dev/null || true
|
||||
docker network disconnect gitea_gitea nas-dashboard-dev 2>/dev/null || true
|
||||
|
||||
# Ensure network exists (create only if it doesn't exist)
|
||||
if ! docker network inspect nas-dashboard_internal >/dev/null 2>&1; then
|
||||
docker network create nas-dashboard_internal
|
||||
fi
|
||||
|
||||
# Use a dedicated project name to avoid killing production (which is project 'nas-dashboard')
|
||||
# and deploy using the synced compose file.
|
||||
docker compose -f docker-compose.dev.yml -p nas-dashboard-dev down --remove-orphans || true
|
||||
# Deploy with compose
|
||||
docker compose -f docker-compose.dev.yml -p nas-dashboard-dev up -d --build --pull never
|
||||
|
||||
Reference in New Issue
Block a user