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
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.
License: CC-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.
Cite this
iinventedlight. 2026. "Docker Engine: port publishing and mapping." iinventedlight Library, iil:note:7crv21va, version of 2026-11-25. https://iinventedlight.com/library/notes/docker-port-publishing/. License: CC-BY-4.0.
@misc{iil_note_7crv21va,
author = {{iinventedlight}},
title = {{Docker Engine: port publishing and mapping}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-25},
url = {https://iinventedlight.com/library/notes/docker-port-publishing/},
note = {Permanent ID iil:note:7crv21va. 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-port-publishing.schema.json (schema; CC-BY-4.0)
- docker-port-publishing.table.json (table; 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-port-publishing.md.