Skip to content

update -p project name flag documentation#10390

Merged
ndeloof merged 1 commit intodocker:v2from
glours:update-project-name-rules
Mar 22, 2023
Merged

update -p project name flag documentation#10390
ndeloof merged 1 commit intodocker:v2from
glours:update-project-name-rules

Conversation

@glours
Copy link
Copy Markdown
Contributor

@glours glours commented Mar 21, 2023

What I did
Update the reference documentation of -p/--project-name attribute to detail the precedence mechanism used to setup the project name of a Compose stack

Related issue
docker/docs#16915
compose-spec/compose-spec#311

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

@glours glours self-assigned this Mar 21, 2023
@glours glours requested review from a team, StefanScherer, laurazard, milas, ndeloof, nicksieger and ulyssessouza and removed request for a team March 21, 2023 16:46
@glours glours force-pushed the update-project-name-rules branch 2 times, most recently from 3038521 to 767ba37 Compare March 21, 2023 16:53
mbland added a commit to mbland/docs that referenced this pull request Mar 21, 2023
This reverts part of commit 9ce29a8.

As @glours noted in the review of docker#16915, this content comes from the
upstream docker/compose repo. He's opened docker/compose#10390 to apply
the update there instead.

Signed-off-by: Mike Bland <[email protected]>
@glours glours force-pushed the update-project-name-rules branch from 767ba37 to 20bfb9b Compare March 22, 2023 08:56
aevesdocker pushed a commit to docker/docs that referenced this pull request Mar 22, 2023
* Add detailed project name requirements, mechanisms

These changes reflect updated `docker compose` behavior regarding
acceptable project names.

compose-spec/compose-go#261 changed `docker compose` behavior to require
normalized project names as input when using `-p`. Previously `docker
compose` normalized project names automatically, leading to errors for
some users after the change landed in compose-spec/compose-go v1.2.5 and
docker/compose v2.5.1.

compose-spec/compose-spec#314 updated the compose spec, effectively
enforcing the same constraint for the `name:` config file property.
compose-spec/compose-go#362 added information to the error message
specifying the correct project name format. compose-spec/compose-go#364
added enforcement of the new project name requirements for all project
name mechanisms (`-p`, `name:`, `COMPOSE_PROJECT_NAME`, project dir,
working dir).

Local development URLs:
- http://localhost:4000/compose/reference/#use--p-to-specify-a-project-name
- http://localhost:4000/compose/environment-variables/envvars/#compose_project_name
- http://localhost:4000/engine/reference/commandline/compose/#use--p-to-specify-a-project-name

Production URLs:
- https://docs.docker.com/compose/reference/#use--p-to-specify-a-project-name
- https://docs.docker.com/compose/environment-variables/envvars/#compose_project_name
- https://docs.docker.com/engine/reference/commandline/compose/#use--p-to-specify-a-project-name

Signed-off-by: Mike Bland <[email protected]>

* Revert _data/compose-cli/docker_compose.yaml

This reverts part of commit 9ce29a8.

As @glours noted in the review of #16915, this content comes from the
upstream docker/compose repo. He's opened docker/compose#10390 to apply
the update there instead.

Signed-off-by: Mike Bland <[email protected]>

---------

Signed-off-by: Mike Bland <[email protected]>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 22, 2023

Codecov Report

❗ No coverage uploaded for pull request base (v2@a11515e). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@          Coverage Diff          @@
##             v2   #10390   +/-   ##
=====================================
  Coverage      ?   59.99%           
=====================================
  Files         ?      104           
  Lines         ?     9008           
  Branches      ?        0           
=====================================
  Hits          ?     5404           
  Misses        ?     3036           
  Partials      ?      568           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ndeloof ndeloof merged commit 6bedc19 into docker:v2 Mar 22, 2023
Comment thread docs/reference/compose.md
Comment on lines +118 to +120
Each configuration has a project name. Compose sets the project name using
the following mechanisms, in order of precedence:
- The `-p` command line flag
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to read twice to understand if the "order or precedence" here went from "lowest to highest" or vice-versa.

Perhaps @aevesdocker or @ChrisChinchilla have suggestions on better phrasing this section.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also mention the long name of the flag in these

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend:

Each configuration has a project name which Compose can set in different ways. The level of precedence (from highest to lowest) for each method is as follows:
This would match the docs

@glours glours deleted the update-project-name-rules branch June 30, 2025 21:18
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.

4 participants