Adding, inspecting, and removing secrets
We will now begin exploring the various commands associated with secrets.
Feel free to also substitute the commands in this section with their Kubernetes equivalent if you wish to try those instead. You can find the list of kubectl
commands at https://kubernetes.io/docs/concepts/configuration/secret/.
Or you can refer back to Chapter 8, Deploying Docker Apps to Kubernetes, where we created, described, retrieved, and edited secrets via kubectl
.
In relation to Docker, we will start by creating secrets first.
Creating
The create
command is how we add a new secret to the Raft log file. Its basic format is the following:
docker secret create [OPTIONS] SECRET [file|-]
You may notice this is similar to the command in kubectl
, which is kubectl create secret
.
When creating a secret, we can use the -l
flag to add a label to the secret, such as the following:
docker secret create -l key=val api_key -
This allows...