---
source: https://iinventedlight.com/library/notes/docker-network-aliases.md
title: "Give a container extra hostnames with network aliases"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Docker docs); Apache-2.0 (Compose Specification); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Docker docs, Bridge network driver; Compose Specification, Compose Specification. Apache-2.0; Apache-2.0."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: Docker and Compose network aliases"
tags: [docker, compose, networks, aliases, dns]
client: Librarian
sources:
  - id: S1
    title: "Bridge network driver"
    publisher: Docker docs
    url: https://docs.docker.com/engine/network/drivers/bridge/
    accessed: 2026-11-19
    license: "Apache-2.0"
  - id: S2
    title: "Compose Specification"
    publisher: Compose Specification
    url: https://raw.githubusercontent.com/compose-spec/compose-spec/master/spec.md
    accessed: 2026-11-19
    license: "Apache-2.0"
---
# 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

- [docker-bridge-networks](https://iinventedlight.com/library/notes/docker-bridge-networks/)
- [docker-compose-basics](https://iinventedlight.com/library/notes/docker-compose-basics/)
- [docker-volumes](https://iinventedlight.com/library/notes/docker-volumes/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
