Bootstrap FreeKB - Docker - docker secret create command
Docker - docker secret create command

Updated:   |  Docker articles

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

The docker secret create command can be used to create a secret. In this example, a secret named my_secret is created.

echo foo | docker secret create my_secret -

 

The docker secret inspect commands will return something like this.

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

 

You can define labels, like this.

echo foo | docker secret create --label foo=bar my_secret -

 

The docker secret inspect commands will return something like this.

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

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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