Skip to content
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

Add detailed project name requirements, mechanisms #16915

Merged
merged 2 commits into from
Mar 22, 2023

Conversation

mbland
Copy link
Contributor

@mbland mbland commented Mar 19, 2023

Proposed changes

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:

Production URLs:

Related issues (optional)

cc: @ndeloof @laurazard @glours

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]>
@mbland mbland requested a review from aevesdocker as a code owner March 19, 2023 22:17
@netlify
Copy link

netlify bot commented Mar 19, 2023

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit a5ca186
🔍 Latest deploy log https://app.netlify.com/sites/docsdocker/deploys/6419e3cb309b8200084e05ae
😎 Deploy Preview https://deploy-preview-16915--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

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

The changes in the _data/compose-cli/docker-compose.yaml should be removed as the reference documentation is coming from docker/compose repository

Comment on lines 66 to 80
Each configuration has a project name. Compose sets the project name using
the following mechanisms, in order of precedence:

- The `-p` command line flag
- The `COMPOSE_PROJECT_NAME` environment variable
- The top level `name:` variable from the config file (or the last `name:`
from a series of config files specified using `-f`)
- The `basename` of the project directory containing the config file (or
containing the first config file specified using `-f`)
- The `basename` of the current directory if no config file is specified

Project names must contain only lowercase letters, decimal digits, dashes,
and underscores, and must begin with a lowercase letter or decimal digit. If
the `basename` of the project directory or current directory violates this
constraint, you must use one of the other mechanisms.
Copy link
Contributor

Choose a reason for hiding this comment

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

This file is generated from the upstream docker/compose repository, I opened a PR to report those changes directly in the reference documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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]>
@aevesdocker aevesdocker requested a review from glours March 21, 2023 17:16
Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

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

LGTM

@aevesdocker aevesdocker merged commit e04f063 into docker:main Mar 22, 2023
@mbland mbland deleted the compose-spec-project-name branch March 22, 2023 13:09
@mbland
Copy link
Contributor Author

mbland commented Mar 22, 2023

@glours @aevesdocker Thanks! I see that the changes here have already landed in the production docs:

but that the changes from docker/compose#10390 haven't yet appeared at:

Purely out of curiosity, how long before those changes propagate?

And per @thaJeztah's observation in docker/compose#10390 (comment), I'm happy to create new PRs (if you prefer) to clarify the first part along the lines of:

Compose sets the project name using the following mechanisms, in order of
precedence from highest to lowest:
- The `-p` or `--project-name` command line flag

@glours
Copy link
Contributor

glours commented Mar 22, 2023

@mbland the missing change is coming in this PR auto-generated by Compose release

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.

3 participants