← All notes

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

Sources

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

Permanent ID: iil:note:ke4c2c69

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.},
}

Markdown

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.

All artifact files (JSON index)

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.