Skip to content

feat: add project name to Docker Compose for isolated environments#9

Merged
hengadev merged 1 commit intomainfrom
staging
Mar 13, 2025
Merged

feat: add project name to Docker Compose for isolated environments#9
hengadev merged 1 commit intomainfrom
staging

Conversation

@hengadev
Copy link
Collaborator

Previously, running multiple environments (e.g., production and staging) with the same docker-compose file caused containers from one environment to replace those from another. This happened because Docker Compose treated them as part of the same project due to the shared file name.

To fix this, we now set the name field in docker-compose.yaml using ${APP_ENV}, ensuring that each environment gets a unique project name. This prevents conflicts and allows production and staging containers to run simultaneously without interfering with each other.

Additionally, this approach improves visibility by defining the project name directly in the compose file rather than relying on the CLI --project-name option.

Previously, running multiple environments (e.g., production and staging) with the same `docker-compose` file caused containers from one environment to replace those from another. This happened because Docker Compose treated them as part of the same project due to the shared file name.

To fix this, we now set the `name` field in `docker-compose.yaml` using `${APP_ENV}`, ensuring that each environment gets a unique project name. This prevents conflicts and allows production and staging containers to run simultaneously without interfering with each other.

Additionally, this approach improves visibility by defining the project name directly in the compose file rather than relying on the CLI `--project-name` option.
@hengadev hengadev merged commit 23828d0 into main Mar 13, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant