2016-11-09 17:35:58 -05:00
|
|
|
---
|
|
|
|
title: "swarm unlock-key"
|
|
|
|
description: "The swarm unlock-keycommand description and usage"
|
|
|
|
keywords: "swarm, unlock-key"
|
|
|
|
---
|
|
|
|
|
|
|
|
# swarm unlock-key
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
Usage: docker swarm unlock-key [OPTIONS]
|
|
|
|
|
|
|
|
Manage the unlock key
|
|
|
|
|
|
|
|
Options:
|
|
|
|
--help Print usage
|
|
|
|
-q, --quiet Only display token
|
|
|
|
--rotate Rotate unlock key
|
|
|
|
```
|
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Description
|
|
|
|
|
2016-11-09 17:35:58 -05:00
|
|
|
An unlock key is a secret key needed to unlock a manager after its Docker daemon
|
|
|
|
restarts. These keys are only used when the autolock feature is enabled for the
|
|
|
|
swarm.
|
|
|
|
|
|
|
|
You can view or rotate the unlock key using `swarm unlock-key`. To view the key,
|
|
|
|
run the `docker swarm unlock-key` command without any arguments:
|
|
|
|
|
2020-04-19 11:08:37 -04:00
|
|
|
> **Note**
|
|
|
|
>
|
|
|
|
> This is a cluster management command, and must be executed on a swarm
|
|
|
|
> manager node. To learn about managers and workers, refer to the
|
|
|
|
> [Swarm mode section](https://docs.docker.com/engine/swarm/) in the
|
|
|
|
> documentation.
|
2018-12-23 06:27:52 -05:00
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Examples
|
2016-11-09 17:35:58 -05:00
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker swarm unlock-key
|
2017-02-07 18:42:48 -05:00
|
|
|
|
2016-11-09 17:35:58 -05:00
|
|
|
To unlock a swarm manager after it restarts, run the `docker swarm unlock`
|
|
|
|
command and provide the following key:
|
|
|
|
|
|
|
|
SWMKEY-1-fySn8TY4w5lKcWcJPIpKufejh9hxx5KYwx6XZigx3Q4
|
|
|
|
|
|
|
|
Please remember to store this key in a password manager, since without it you
|
|
|
|
will not be able to restart the manager.
|
|
|
|
```
|
|
|
|
|
|
|
|
Use the `--rotate` flag to rotate the unlock key to a new, randomly-generated
|
|
|
|
key:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker swarm unlock-key --rotate
|
2020-04-19 09:43:08 -04:00
|
|
|
|
2016-11-09 17:35:58 -05:00
|
|
|
Successfully rotated manager unlock key.
|
|
|
|
|
|
|
|
To unlock a swarm manager after it restarts, run the `docker swarm unlock`
|
|
|
|
command and provide the following key:
|
|
|
|
|
|
|
|
SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
|
|
|
|
|
|
|
|
Please remember to store this key in a password manager, since without it you
|
|
|
|
will not be able to restart the manager.
|
|
|
|
```
|
|
|
|
|
|
|
|
The `-q` (or `--quiet`) flag only prints the key:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker swarm unlock-key -q
|
2020-04-19 09:43:08 -04:00
|
|
|
|
2016-11-09 17:35:58 -05:00
|
|
|
SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
|
|
|
|
```
|
|
|
|
|
|
|
|
### `--rotate`
|
|
|
|
|
|
|
|
This flag rotates the unlock key, replacing it with a new randomly-generated
|
|
|
|
key. The old unlock key will no longer be accepted.
|
|
|
|
|
|
|
|
### `--quiet`
|
|
|
|
|
|
|
|
Only print the unlock key, without instructions.
|
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Related commands
|
2016-11-09 17:35:58 -05:00
|
|
|
|
2017-05-10 18:34:56 -04:00
|
|
|
* [swarm ca](swarm_ca.md)
|
2016-11-09 17:35:58 -05:00
|
|
|
* [swarm init](swarm_init.md)
|
2016-12-19 12:55:51 -05:00
|
|
|
* [swarm join](swarm_join.md)
|
2020-04-19 09:43:08 -04:00
|
|
|
* [swarm join-token](swarm_join-token.md)
|
2016-12-19 12:55:51 -05:00
|
|
|
* [swarm leave](swarm_leave.md)
|
|
|
|
* [swarm unlock](swarm_unlock.md)
|
2016-11-09 17:35:58 -05:00
|
|
|
* [swarm update](swarm_update.md)
|