...

Text file src/github.com/docker/cli/docs/reference/commandline/swarm_unlock-key.md

Documentation: github.com/docker/cli/docs/reference/commandline

     1# swarm unlock-key
     2
     3<!---MARKER_GEN_START-->
     4Manage the unlock key
     5
     6### Options
     7
     8| Name            | Type | Default | Description        |
     9|:----------------|:-----|:--------|:-------------------|
    10| `-q`, `--quiet` |      |         | Only display token |
    11| `--rotate`      |      |         | Rotate unlock key  |
    12
    13
    14<!---MARKER_GEN_END-->
    15
    16## Description
    17
    18An unlock key is a secret key needed to unlock a manager after its Docker daemon
    19restarts. These keys are only used when the autolock feature is enabled for the
    20swarm.
    21
    22You can view or rotate the unlock key using `swarm unlock-key`. To view the key,
    23run the `docker swarm unlock-key` command without any arguments:
    24
    25> **Note**
    26>
    27> This is a cluster management command, and must be executed on a swarm
    28> manager node. To learn about managers and workers, refer to the
    29> [Swarm mode section](https://docs.docker.com/engine/swarm/) in the
    30> documentation.
    31
    32## Examples
    33
    34```console
    35$ docker swarm unlock-key
    36
    37To unlock a swarm manager after it restarts, run the `docker swarm unlock`
    38command and provide the following key:
    39
    40    SWMKEY-1-fySn8TY4w5lKcWcJPIpKufejh9hxx5KYwx6XZigx3Q4
    41
    42Please remember to store this key in a password manager, since without it you
    43will not be able to restart the manager.
    44```
    45
    46Use the `--rotate` flag to rotate the unlock key to a new, randomly-generated
    47key:
    48
    49```console
    50$ docker swarm unlock-key --rotate
    51
    52Successfully rotated manager unlock key.
    53
    54To unlock a swarm manager after it restarts, run the `docker swarm unlock`
    55command and provide the following key:
    56
    57    SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
    58
    59Please remember to store this key in a password manager, since without it you
    60will not be able to restart the manager.
    61```
    62
    63The `-q` (or `--quiet`) flag only prints the key:
    64
    65```console
    66$ docker swarm unlock-key -q
    67
    68SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
    69```
    70
    71### `--rotate`
    72
    73This flag rotates the unlock key, replacing it with a new randomly-generated
    74key. The old unlock key will no longer be accepted.
    75
    76### `--quiet`
    77
    78Only print the unlock key, without instructions.
    79
    80## Related commands
    81
    82* [swarm ca](swarm_ca.md)
    83* [swarm init](swarm_init.md)
    84* [swarm join](swarm_join.md)
    85* [swarm join-token](swarm_join-token.md)
    86* [swarm leave](swarm_leave.md)
    87* [swarm unlock](swarm_unlock.md)
    88* [swarm update](swarm_update.md)

View as plain text