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

check container_name is not in use by another service we will create #11713

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented Apr 11, 2024

What I did
check container_name is not in use by another service we will create

Related issue
see compose-spec/compose-go#619

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

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

@glours
Copy link
Contributor

glours commented Apr 16, 2024

Ho can we add a test to be sure we won't have regression in future as this check is managed here now and not in compose-go anymore?

@ndeloof
Copy link
Contributor Author

ndeloof commented Apr 16, 2024

@glours I have a test case ready but need to wait for compose-spec/compose-go#619 to be merged otherwise test will fail as compose-go will prevent loading compose.yaml file with same container_name used by services

@ndeloof ndeloof force-pushed the container_name branch 2 times, most recently from 182b2ca to 0b41c75 Compare April 16, 2024 11:10
func (s *composeService) create(ctx context.Context, project *types.Project, options api.CreateOptions) error {
if len(options.Services) == 0 {
options.Services = project.ServiceNames()
}

err := checkContainerNameUnicity(project)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should also call this on compose config

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof ndeloof enabled auto-merge (rebase) April 16, 2024 15:20
@ndeloof ndeloof merged commit d239f0f into docker:main Apr 16, 2024
28 checks passed
@ndeloof ndeloof deleted the container_name branch April 16, 2024 15:27
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.

None yet

3 participants