-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement #745: Ability to set default project name in YML #3118
Conversation
70fd6f2
to
98f0ddb
Compare
a203ff4
to
c9202b5
Compare
We discussed this a bit recently. Any We weren't really able to come up with a good way to express this. Some ideas that have been suggested previously are:
I think it's going to be important to make it clear that this name is just a default. |
@dnephin good point. I think
What do you think? |
c9202b5
to
036f2e5
Compare
05db31c
to
036f2e5
Compare
Add `project` section in yml and provide `default_name` option. This will allow users to specify default project name in YML and provides more clear difference between default and custom project names. Signed-off-by: Sergey Protko <[email protected]>
036f2e5
to
ce15283
Compare
Looks like we would not be able to merge this PR because of merge conflicts. Please rebase, fix conflicts, and force push to your branch. |
1 similar comment
Looks like we would not be able to merge this PR because of merge conflicts. Please rebase, fix conflicts, and force push to your branch. |
Closing this in flavor of #3057 |
So was the idea of project name in yml abandoned? #3057 only allows to set project name via .env file. |
@adrianolek well... my implementation doesn't allow to override default name from another Also all other cases that I looked to easily solves via env variables (personally I just specify all this in CI build/deploy job as ENV variables and it works for me). Allowing to override default project name using multiple compose file just creates a lot of edge cases and this should be discussed. |
Added
project
section in docker compose file, which allows users to define default project name in their yaml files:This will help teams not to forgot about that. For example in my company i have only 5 project, which uses docker compose, and I already experience some problems since developers sometime forgot to add custom project name.
Name resolution rules
-p
cli option if providedCOMPOSE_NAME
env variable if availabledefault_name
option fromproject
section of yml fileif providedMultiple compose files
If multiple compose yml files provided,
project
section will be used only from main one.docker-compose.yml:
docker-compose.override.yml:
If we start docker-compose as usual (i.e.
docker-compose.override.yml
will override service definition in main file), then project name will befoo
.But if we change the order of files:
then
bar
will be used as project name.