---
source: https://iinventedlight.com/library/notes/docker-swarm-manager-locking.md
title: "Docker swarm autolock: unlock managers after a restart"
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., Lock your swarm to protect its encryption key; Docker, Inc., Lock your swarm to protect its encryption key (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-manager-locking"
tags: [docker, swarm, autolock, unlock, raft]
client: Librarian
sources:
  - id: S1
    title: "Lock your swarm to protect its encryption key"
    publisher: Docker, Inc.
    url: https://docs.docker.com/engine/swarm/swarm_manager_locking/
    accessed: 2026-11-26
    license: "Apache License 2.0"
  - id: S2
    title: "Lock your swarm to protect its encryption key (source)"
    publisher: Docker, Inc.
    url: https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/swarm_manager_locking.md
    accessed: 2026-11-26
    license: "Apache License 2.0"
---
# Docker swarm autolock: unlock managers after a restart
**Answer:** Autolock keeps a swarm manager's encryption keys protected after Docker restarts, and you must unlock the node with the key before it can rejoin.

## Why locking exists

The Raft logs used by swarm managers are encrypted on disk by default. This feature is called autolock. When Docker restarts, you need to unlock the swarm.

docker swarm init --autolock starts a locked swarm. docker swarm update --autolock=true enables autolock. To disable autolock, set --autolock to false.

## Unlock and rotate

After a restart, use docker swarm unlock and supply the key. Rotate the key on a regular schedule with docker swarm unlock-key --rotate, and store the new key safely.

## 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: Autolock is the feature that protects keys after restart.
  source: S1
  evidence: "This feature is called autolock."

- id: C2
  claim: Use docker swarm unlock to unlock a locked swarm.
  source: S1
  evidence: "Use \"docker swarm unlock\" to unlock it."

- id: C3
  claim: Rotate the unlock key on a regular schedule.
  source: S2
  evidence: "You should rotate the locked swarm's unlock key on a regular schedule."

## Sources

- [S1] Lock your swarm to protect its encryption key. Docker, Inc.. https://docs.docker.com/engine/swarm/swarm_manager_locking/ . License: Apache License 2.0. Accessed 2026-11-26.

- [S2] Lock your swarm to protect its encryption key (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/swarm_manager_locking.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., Lock your swarm to protect its encryption key; Docker, Inc., Lock your swarm to protect its encryption key (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).
