I played with https://labs.play-with-docker.com/.
I chose the template of 3 Managers and 2 Workers
:
I went to manager1
and created a secret:
echo "mydatabasepassword" | docker secret create db_pass -
I checked and the secret is exist:
I wanted to check the secrets folder but it doesn't exist:
I also tried like this:
Any idea where can it be ?
Following Bret Fisher answer, here is an example:
*I could get the name of the container only from the manager leader.
Secrets are stored on the manager host in the encrypted raft db, so you can't view them from host. To see them in a container you need to assign them on docker service create, so:
docker service create --secret=db_pass --name example nginx
Then from the node that was assigned the container you can see the text file in the container (container name will be different):
docker exec example.1.m1c4bvubej64xc1csclnq7y3r cat /run/secrets/db_pass