From 9ec93b4352db8ae7220f8966e2fbd3967e05f7d9 Mon Sep 17 00:00:00 2001 From: surtur Date: Sat, 24 Jul 2021 15:36:21 +0200 Subject: [PATCH] ci/compose: add project name using a drone env var there was an issue where https://git.dotya.ml/dotya.ml/homepage containers were getting orphaned when this project was deployed. messages like the following were printed: Removing orphan container "src_homepage_2" Removing orphan container "src_homepage_4" Removing orphan container "src_reverse-proxy_1" Removing orphan container "src_homepage_3" Removing orphan container "src_homepage_1" The author of the accepted answer of a related SO thread links to docker-compose documentation, explaining how setting a project variable should resolve this. the COMPOSE_PROJECT_NAME environment variable is likely the same for both projects in question here (homepage and docs) as they're both being deployed by drone from the /drone/src directory, which is also set by drone as the WORKDIR). basename - here src - is used as the project name if not specified otherwise. to conclude, running both [compose deployments] with a unique project name should fix the issue. refs: https://stackoverflow.com/a/59173539 https://docs.docker.com/compose/reference/overview/#use--p-to-specify-a-project-name https://docs.docker.com/compose/reference/envvars/#compose_project_name fix #1 --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index c5837e4..92048e2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -111,7 +111,7 @@ steps: - name: s path: /var/run/docker.sock commands: - - docker-compose up -d --remove-orphans + - docker-compose up -d --remove-orphans -p ${DRONE_REPO_NAME} when: branch: master status: success