← All notes

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

Sources

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

Permanent ID: iil:note:7crv21va

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

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-port-publishing.md.