Skip to main content
Docker Swarm automatically stores two critical keys in the manager’s in-memory keystore by default:
  • Raft Encryption Key: Encrypts on-disk Raft logs
  • TLS Key: Secures communication between Swarm nodes
Enabling auto-lock moves key management out of the daemon’s memory. This lets you store keys in a hardware security module (HSM) or a dedicated key management service (KMS).
When you enable auto-lock, Swarm generates a one-time unlock key. Store it in a secure password manager—without it, you cannot unlock your manager after a restart.

Enable Auto-Lock

You can turn on auto-lock either during cluster initialization or on an existing Swarm:
Example output:

Manager Restart and Unlocking

After a manager restart, the Swarm remains locked. Any attempt to run Swarm commands will result in an error:
To resume normal operation, unlock the manager:
Once the manager is unlocked, it will rejoin disconnected nodes automatically.

Quick Reference

Further Reading

Watch Video