---
source: https://iinventedlight.com/library/notes/docker-port-publishing.md
title: "Docker Engine: port publishing and mapping"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache License 2.0 (Docker, Inc.); Apache License 2.0 (Docker, Inc.); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., Port publishing and mapping; Docker, Inc., Port publishing and mapping (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-25
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-25
as_of: 2026-11-25
confidence: medium
untested: "Not reproduced (2026-11-25). 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-port-publishing"
tags: [docker, ports, publish, nat, networking]
client: Librarian
sources:
  - id: S1
    title: "Port publishing and mapping"
    publisher: Docker, Inc.
    url: https://docs.docker.com/engine/network/port-publishing/
    accessed: 2026-11-25
    license: "Apache License 2.0"
  - id: S2
    title: "Port publishing and mapping (source)"
    publisher: Docker, Inc.
    url: https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/network/port-publishing.md
    accessed: 2026-11-25
    license: "Apache License 2.0"
---
# Docker Engine: port publishing and mapping
**Answer:** Published container ports are mapped to host IP addresses.

## Default blocking

For IPv4 and for IPv6, the daemon blocks access to unpublished ports.

Firewall rules perform NAT, PAT, and masquerading to create the mapping.

Outgoing connections from the container will masquerade, using the Docker host's IP address.

## Publishing a port

On bridge networks, container ports are accessible from the Docker host and from other containers on that same network.

Those ports are not accessible from outside the host under the default configuration.

The publish flag makes a port available outside the host, and to containers in other bridge networks.

## See also

- [docker-port](https://iinventedlight.com/library/notes/docker-port/)
- [docker-network](https://iinventedlight.com/library/notes/docker-network/)
- [docker-expose](https://iinventedlight.com/library/notes/docker-expose/)

## Claims

- id: C1
  claim: Published container ports are mapped to host IP addresses.
  source: S1
  evidence: "Published container ports are mapped to host IP addresses."

- id: C2
  claim: Outgoing connections masquerade using the Docker host's IP address.
  source: S1
  evidence: "Outgoing connections from the container will masquerade, using the Docker host's IP address."

- id: C3
  claim: Published container ports are mapped to host IP addresses.
  source: S2
  evidence: "Published container ports are mapped to host IP addresses."

- id: C4
  claim: Outgoing connections masquerade using the Docker host's IP address.
  source: S2
  evidence: "Outgoing connections from the container will masquerade, using the Docker host's IP address."

## Sources

- [S1] Port publishing and mapping. Docker, Inc.. https://docs.docker.com/engine/network/port-publishing/ . License: Apache License 2.0. Accessed 2026-11-25.

- [S2] Port publishing and mapping (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/network/port-publishing.md . License: Apache License 2.0. Accessed 2026-11-25.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., Port publishing and mapping; Docker, Inc., Port publishing and mapping (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.

---

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