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

define compose container names with a valid hostname #8655

Merged
merged 1 commit into from
Sep 22, 2021

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented Sep 22, 2021

This is a proposal to fix long running issue #229

tl;dr:
docker-compose creates containers as project_service_number which make them invalid hostnames. Most tools support this mistakes, but some don't.

As we move to Compose V2, we have a unique opportunity to fix this with a minor backward compatibility break. Maybe we could have this controlled by some COMPOSE_COMPATIBILITY env variable, and/or resurrect the --compatibility flag

Resolves #229

@ndeloof ndeloof force-pushed the valid_hostname branch 4 times, most recently from 62ded22 to aca0d49 Compare September 22, 2021 08:58
@thaJeztah
Copy link
Member

wondering; would it help with the transition if we would set the "old" name as an (network) alias?

Also possibly related if we'll be changing conventions; moby/swarmkit#1242

Copy link
Contributor

@ulyssessouza ulyssessouza left a comment

Choose a reason for hiding this comment

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

Maybe just add a test with the --compatibility

@ndeloof ndeloof force-pushed the valid_hostname branch 2 times, most recently from 870bae3 to 031b74e Compare September 22, 2021 15:17
Copy link
Contributor

@ulyssessouza ulyssessouza left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof ndeloof merged commit 99e7563 into docker:v2 Sep 22, 2021
@ndeloof ndeloof deleted the valid_hostname branch September 22, 2021 17:06
@ndeloof
Copy link
Contributor Author

ndeloof commented Sep 22, 2021

would it help with the transition if we would set the "old" name as an (network) alias?

I don't think this would be very useful, as recommended way to access sibling container is to use service name, not plain container name anyway.

antoineco added a commit to deviantony/docker-elk that referenced this pull request Oct 6, 2021
The naming scheme of containers created by Compose has changed in V2.

Ref. docker/compose#8655
@docker docker deleted a comment from Lastro10 Oct 27, 2021
})

t.Run("check container names", func(t *testing.T) {
res := c.RunDockerCmd("ps", "--format", "{{.Names}}")

Choose a reason for hiding this comment

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

pkg/e2e/compose_test.go

@Lastro10
Copy link

@[pkg/e2e/restart_test.go]() #@

@Lastro10
Copy link

``pkg/e2e/restart_test.go

@thaJeztah
Copy link
Member

Reported the account above for abuse/spam

DanBrown47 pushed a commit to DanBrown47/docker-elk that referenced this pull request Jun 22, 2023
The naming scheme of containers created by Compose has changed in V2.

Ref. docker/compose#8655
azuredevil0818 pushed a commit to azuredevil0818/docker-elk that referenced this pull request Jul 8, 2023
The naming scheme of containers created by Compose has changed in V2.

Ref. docker/compose#8655
k-ishigaki added a commit to k-ishigaki/review-template that referenced this pull request Aug 27, 2023
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.

Switch to using hyphens as a separator in hostnames
4 participants