FreeKB - Docker list secrets using curl
Docker - list secrets using curl

A secret is a file that contains sensitive data, such as a password.

You will need an auth_token before you can list secrets using curl. 

The following curl command can be used to list every secret. 

curl -k -H "Authorization: Bearer $auth_token" -H 'Accept: application/json' https://hostname:port/secrets

 

Or you can list a single secret by including the id of the secret.

curl -k -H "Authorization: Bearer $auth_token" -H 'Accept: application/json' https://hostname:port/secrets/zt7b37icxabcgz123tnjudjn6

 

Or the name of the secret.

curl -k -H "Authorization: Bearer $auth_token" -H 'Accept: application/json' https://hostname:port/secrets/my_secret

 

If the secret exists, something like this will be displayed.

{
 "ID":"pp6d206pqk28cj12kjv36l2v7 "
 "Version":{
            "Index":16114223
           }
 "CreatedAt":"2019-03-11T18:16:09.317112631Z"
 "UpdatedAt":"2019-03-11T18:16:09.317112631Z"
 "Spec":{
         "Name":"my_secret"
         "Labels":{}
        }
}

 

If the secret does not exist, this will be displayed.

{
 "message":"Error: No such secret: my_secret"
}

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 99dad in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |