---
source: https://iinventedlight.com/library/notes/docker-swarm-pki.md
title: "Docker swarm PKI: mutual TLS, a root CA, and join tokens"
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., Manage swarm security with public key infrastructure (PKI); Docker, Inc., Manage swarm security with public key infrastructure (PKI) (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-pki"
tags: [docker, swarm, pki, tls, certificate-authority]
client: Librarian
sources:
  - id: S1
    title: "Manage swarm security with public key infrastructure (PKI)"
    publisher: Docker, Inc.
    url: https://docs.docker.com/engine/swarm/how-swarm-mode-works/pki/
    accessed: 2026-11-26
    license: "Apache License 2.0"
  - id: S2
    title: "Manage swarm security with public key infrastructure (PKI) (source)"
    publisher: Docker, Inc.
    url: https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/how-swarm-mode-works/pki.md
    accessed: 2026-11-26
    license: "Apache License 2.0"
---
# Docker swarm PKI: mutual TLS, a root CA, and join tokens
**Answer:** Docker Swarm mode includes a public key infrastructure system so nodes can authenticate, authorize, and encrypt traffic to one another with mutual TLS.

## The built-in CA

Running docker swarm init creates the swarm and makes the current engine a manager.

By default, the manager generates a new root Certificate Authority and a key pair used to secure communications with joining nodes.

The --external-ca flag of docker swarm init lets you specify your own externally-generated root CA.

## Join tokens

The manager also issues two join tokens, one for workers and one for managers.

Each token carries a digest of the root CA certificate plus a randomly generated secret.

The joining node uses the digest to check the manager's CA certificate, and the manager uses the secret to confirm the joiner is approved.

## See also

- [docker-swarm](https://iinventedlight.com/library/notes/docker-swarm/)
- [docker-swarm-admin](https://iinventedlight.com/library/notes/docker-swarm-admin/)
- [docker-swarm-secrets](https://iinventedlight.com/library/notes/docker-swarm-secrets/)

## Claims

- id: C1
  claim: docker swarm init makes the current node a manager.
  source: S1
  evidence: "Docker designates itself as a manager node."

- id: C2
  claim: An external root CA can be passed with --external-ca.
  source: S1
  evidence: "using the --external-ca flag of the docker swarm init command."

- id: C3
  claim: The manager generates a worker token and a manager token.
  source: S2
  evidence: "one worker token and one manager token."

## Sources

- [S1] Manage swarm security with public key infrastructure (PKI). Docker, Inc.. https://docs.docker.com/engine/swarm/how-swarm-mode-works/pki/ . License: Apache License 2.0. Accessed 2026-11-26.

- [S2] Manage swarm security with public key infrastructure (PKI) (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/how-swarm-mode-works/pki.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., Manage swarm security with public key infrastructure (PKI); Docker, Inc., Manage swarm security with public key infrastructure (PKI) (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).
