---
source: https://iinventedlight.com/library/notes/docker-swarm-ingress.md
title: "Docker Swarm ingress: publish ports through the routing mesh"
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., Use Swarm mode routing mesh; Docker, Inc., Use Swarm mode routing mesh (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-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). 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-swarm-ingress"
tags: [docker, swarm, ingress, routing-mesh, ports]
client: Librarian
sources:
  - id: S1
    title: "Use Swarm mode routing mesh"
    publisher: Docker, Inc.
    url: https://docs.docker.com/engine/swarm/ingress/
    accessed: 2026-11-26
    license: "Apache License 2.0"
  - id: S2
    title: "Use Swarm mode routing mesh (source)"
    publisher: Docker, Inc.
    url: https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/ingress.md
    accessed: 2026-11-26
    license: "Apache License 2.0"
---
# Docker Swarm ingress: publish ports through the routing mesh
**Answer:** In Swarm mode, every node joins an ingress routing mesh that forwards published ports to running tasks.

## How the mesh publishes a port

Incoming requests to published ports are routed to an active container.

The --publish flag publishes a port when you create a service.

target is the port inside the container; published is the port bound on the routing mesh.

If you omit the published port, a random high-numbered port is bound.

## Protocols and host mode

By default, a published port is a TCP port.

You can publish UDP instead of, or as well as, TCP.

Docker effectively load-balances swarm services through this mesh.

To skip the mesh for a service, use the long --publish form and set mode to host.

## See also

- [docker-swarm](https://iinventedlight.com/library/notes/docker-swarm/)
- [docker-swarm-networking](https://iinventedlight.com/library/notes/docker-swarm-networking/)
- [docker-port-publishing](https://iinventedlight.com/library/notes/docker-port-publishing/)

## Claims

- id: C1
  claim: Every node takes part in the ingress routing mesh.
  source: S1
  evidence: "All nodes participate in an ingress routing mesh."

- id: C2
  claim: You can bypass the routing mesh for a service.
  source: S1
  evidence: "You can also bypass the routing mesh for a given service."

- id: C3
  claim: Published ports are TCP by default.
  source: S2
  evidence: "By default, when you publish a port, it is a TCP port."

- id: C4
  claim: The mesh load-balances swarm services.
  source: S2
  evidence: "Effectively, Docker acts as a load balancer for your swarm services."

## Sources

- [S1] Use Swarm mode routing mesh. Docker, Inc.. https://docs.docker.com/engine/swarm/ingress/ . License: Apache License 2.0. Accessed 2026-11-26.

- [S2] Use Swarm mode routing mesh (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/ingress.md . License: Apache License 2.0. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., Use Swarm mode routing mesh; Docker, Inc., Use Swarm mode routing mesh (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).
