Skip to content

feat(network): let a service opt out of its name as a network alias - #14342

Merged
ndeloof merged 1 commit into
docker:mainfrom
glours:service-name-alias-opt-out
Oct 16, 2026
Merged

ndeloof merged 1 commit into
docker:mainfrom
glours:service-name-alias-opt-out

Conversation

@glours

@glours glours commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Honor the use_service_name_alias attribute of a service's networks entry (compose-spec/compose-spec#663): when false, the service name is not registered as a DNS alias on that network. The container name alias, the user's aliases and the service's other networks are untouched, and unset keeps the current behavior. --use-aliases on run still decides whether any alias is set.

This lets two projects sharing a network run a service with the same name without resolving it to either container.

Blocked on compose-spec/compose-go#943, which adds the field. go.mod temporarily replaces compose-go with that branch; the replace must be dropped before merging.

Related issue

Closes #8223

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

@glours
glours requested review from a team as code owners October 14, 2026 16:41
@glours
glours requested a review from ndeloof October 14, 2026 16:41

@docker-agent docker-agent left a comment

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.

Assessment: 🔴 CRITICAL

One confirmed security/integrity finding: a directive in that redirects the core dependency to a personal fork. The PR author explicitly notes this must be removed before merging, but no automated gate prevents accidental merge.

Comment thread go.mod Resolved
@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@glours
glours requested a review from docker-agent October 15, 2026 07:11
@glours
glours force-pushed the service-name-alias-opt-out branch from 98789a1 to 19cf004 Compare October 15, 2026 07:15

@docker-agent docker-agent left a comment

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.

Assessment: 🟢 APPROVE

The service name is always registered as a DNS alias on every network a
service is attached to, so two projects sharing a network and running a
service with the same name resolve it to either container.

Honor the use_service_name_alias attribute of a service's network
entry: when false, the service name is not registered as an alias on
that network only. The container name alias, the user's aliases and the
service's other networks are untouched, and --use-aliases still decides
whether any alias is set. Unset keeps the current behavior.

The attribute comes from compose-go, through its ServiceNameAliasEnabled
helper. go.mod temporarily replaces compose-go with its main branch,
which has it: drop the replace once a version containing it is tagged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
@glours
glours force-pushed the service-name-alias-opt-out branch from 19cf004 to ec5ca35 Compare October 16, 2026 08:26
@ndeloof
ndeloof enabled auto-merge (rebase) October 16, 2026 08:29
@ndeloof
ndeloof merged commit f647bc0 into docker:main Oct 16, 2026
60 checks passed
@ndeloof
ndeloof deleted the service-name-alias-opt-out branch October 16, 2026 08:36
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.

Add option to remove service name as default alias on networks

3 participants