Secrets in action – examples
It's now time to try out the commands we just reviewed (create
/inspect
/ls
/rm
). Make sure your setup is configured to use swarms. You can also re-use the image from the previous chapter for this section. This can be obtained using the following command:
$ docker pull docker pull dockerfordevelopers/shipitclicker@ sha256:39eda93d15866957feaee28f8fc5adb545276a64147445c64992ef 69804dbf01
Important note
Remember, you can use the docker swarm init
command to initialize the swarm. Use the --advertise-addr
flag with the IP address of your initial container as well.
Previously, we used the following command to add an SSH private key for use with SCP to a single container:
$ docker build --build-arg ssh_prv_key="$(cat ~/.ssh/id_rsa_test)" .
To add this key to our swarm, we would use the following command:
$ docker secret create -l env=dev ssh_prv_key ~/.ssh/id_rsa_test