Proposal: make project-name persistent.
Problem
By default, Compose bases the project name on basename of the directory compose commands are run from. The project name can be overridden either by passing a `-p / --project-name` option for each command or setting the `COMPOSE_PROJECT_NAME` environment variable. Using the `--project-name` option for _each_ command is error-prone and for- getting to pass the option when doing (for example) `docker-compose up`, will result in _another_ instance of the project being created under a different name or even containers of a different project being replaced. Using the `COMPOSE_PROJECT_NAME` environment variable is not useful when dealing with multiple projects and can cause similar problems. Proposal: make project-name persistent To solve these problems, compose will save the name of a project to a file in the build-context when the project is first started / built. If a project-file is found, compose automatically uses the project-name from that file and throw an exception if the user is trying to override the project-name using the `--project-name` option. File location To allow further expansion of options, compose creates a hidden `.docker-compose` directory in the "root" directory of the build-context. Inside that directory, a `project-name` file is created, containing just the name of the project; [code block] Request for comment There are a couple of things left to be discussed; - Should the configuration-file be created _automatically_ or should this be an exp
Error Output
exception if the user is trying to override the project-name
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Proposal: make project-name persistent.
I actually think the project name is pretty important. If you want to be able to do anything with the images in a CI pipeline, you need to know the project name to be able to retag them as something else. Being able to override project name from an environment variables makes it easy to keep these unique, and predictable. I think no matter what happens, we need to support the override from enviro
Trust Score
9 verifications
- 1
I actually think the project name is pretty important. If you want to be able to
I actually think the project name is pretty important. If you want to be able to do anything with the images in a CI pipeline, you need to know the project name to be able to retag them as something else.
- 2
Being able to override project name from an environment variables makes it easy
Being able to override project name from an environment variables makes it easy to keep these unique, and predictable. I think no matter what happens, we need to support the override from environment variables.
- 3
I do like the idea of making the project name configurable from a file. I think
I do like the idea of making the project name configurable from a file. I think a similar discussion happened in (#45). Having the project name in`.fig/project-name` seems like it will lead to a lot of really small files. I think it would be easier to just put it into the `fig.yml` itself (like it is suggested in #45, and one of the docker compose proposals).
- 4
What are the advantages of putting it in a separate directory and file?
What are the advantages of putting it in a separate directory and file?
Validation
Resolved in docker/compose GitHub issue #745. Community reactions: 86 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep