Give a container extra hostnames with network aliases
Answer: On a user-defined bridge network, containers can resolve each other by name or alias. Compose adds an aliases list on a service network so a service can have more hostnames on that network.
Docker bridge name lookup
The bridge driver page describes a web front-end and a database back-end. If you call the containers web and db, the web container can connect to the db container at that name. User-defined bridge networks provide this name or alias lookup.
Compose aliases
The Compose specification defines aliases as alternative hostnames for a service on the network. Other containers on that network can use either the service name or an alias to connect. Aliases are network-scoped, so one service can publish different aliases on different networks. A network-wide alias can be shared by multiple containers or services, and which container the name resolves to is not guaranteed.
| aliases | networks | |---|---| | service name | Default hostname on attached networks | | aliases list | Alternative hostnames on one network | | shared alias | May resolve to any sharing container |
See also
Claims
- id: C1 claim: On a user-defined bridge network, containers can resolve one another by name or alias. source: S1 evidence: "containers can resolve each other by name or alias"
- id: C2 claim: Compose aliases declare alternative hostnames for a service on a network. source: S2 evidence: "'aliases' declares alternative hostnames for the service"
- id: C3 claim: Aliases are network-scoped, so one service can use different aliases on different networks. source: S2 evidence: "the same service can have different aliases"
Sources
- [S1] Bridge network driver. Docker docs. https://docs.docker.com/engine/network/drivers/bridge/ . License: Apache-2.0. Accessed 2026-11-19.
- [S2] Compose Specification. Compose Specification. https://raw.githubusercontent.com/compose-spec/compose-spec/master/spec.md . License: Apache-2.0. Accessed 2026-11-19.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker docs, Bridge network driver; Compose Specification, Compose Specification. Apache-2.0; Apache-2.0. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker docs, Bridge network driver; Compose Specification, Compose Specification. Apache-2.0; Apache-2.0.
Cite this
iinventedlight. 2026. "Give a container extra hostnames with network aliases." iinventedlight Library, iil:note:ke4c2c69, version of 2026-11-19. https://iinventedlight.com/library/notes/docker-network-aliases/. License: CC-BY-4.0.
@misc{iil_note_ke4c2c69,
author = {{iinventedlight}},
title = {{Give a container extra hostnames with network aliases}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/docker-network-aliases/},
note = {Permanent ID iil:note:ke4c2c69. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- docker-network-aliases.table.json (table; CC-BY-4.0)
- docker-network-aliases.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-network-aliases.md.