Join our Discord Server
Docker Secrets Management

Step 2. Manage Secrets

Estimated reading: 1 minute 62 views

In this step you’ll use the docker secret sub-command to list and inspect secrets.

Before going any further it’s important to note that once a secret is created it is securely stored in the Swarm’s encrypted Raft store. This means that you cannot view it in plain text using the docker secret command.

Perform all of the following commands from a Swarm manager. The lab assumes you will be using node1 in your lab.

  1. List existing secrets with the docker secret ls command.
  node1$ docker secret ls
  ID                     NAME      CREATED             UPDATED
  ftu76ghg...rj3wx3xcd   sec1      11 seconds ago      11 seconds ago
  1. Inspect the sec1 secret.
  node1$ docker secret inspect sec1
  [
    {
        "ID": "ftu76ghgsk7f9fmcrj3wx3xcd",
        "Version": {
            "Index": 113
        },
        "CreatedAt": "2017-03-21T18:41:08.790769302Z",
        "UpdatedAt": "2017-03-21T18:41:08.790769302Z",
        "Spec": {
            "Name": "sec1"
        }
    }
  ]

Notice that the docker secret inspect command does not display the unencrypted contents of the secret.

You can use the docker secret rm command to delete secrets. To delete the sec1 secret you would use the command docker secret rm sec1Do not delete the sec1 secret as you will use it in the next section.

Share this Doc

Step 2. Manage Secrets

Or copy link

CONTENTS
Join our Discord Server