github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/commandline/swarm_unlock-key.md (about)

     1  # swarm unlock-key
     2  
     3  <!---MARKER_GEN_START-->
     4  Manage 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  
    18  An unlock key is a secret key needed to unlock a manager after its Docker daemon
    19  restarts. These keys are only used when the autolock feature is enabled for the
    20  swarm.
    21  
    22  You can view or rotate the unlock key using `swarm unlock-key`. To view the key,
    23  run 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  
    37  To unlock a swarm manager after it restarts, run the `docker swarm unlock`
    38  command and provide the following key:
    39  
    40      SWMKEY-1-fySn8TY4w5lKcWcJPIpKufejh9hxx5KYwx6XZigx3Q4
    41  
    42  Please remember to store this key in a password manager, since without it you
    43  will not be able to restart the manager.
    44  ```
    45  
    46  Use the `--rotate` flag to rotate the unlock key to a new, randomly-generated
    47  key:
    48  
    49  ```console
    50  $ docker swarm unlock-key --rotate
    51  
    52  Successfully rotated manager unlock key.
    53  
    54  To unlock a swarm manager after it restarts, run the `docker swarm unlock`
    55  command and provide the following key:
    56  
    57      SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
    58  
    59  Please remember to store this key in a password manager, since without it you
    60  will not be able to restart the manager.
    61  ```
    62  
    63  The `-q` (or `--quiet`) flag only prints the key:
    64  
    65  ```console
    66  $ docker swarm unlock-key -q
    67  
    68  SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
    69  ```
    70  
    71  ### `--rotate`
    72  
    73  This flag rotates the unlock key, replacing it with a new randomly-generated
    74  key. The old unlock key will no longer be accepted.
    75  
    76  ### `--quiet`
    77  
    78  Only 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)