I am trying to learn docker secret. I will use Docker Swarm and only have a maximum of 1 node in the cluster. I ran these commands:

docker swarm init;
printf "test123" | docker secret create db_password -
docker swarm leave -f;
docker swarm init;
docker secret ls;

I see this result:


This means the secrets were lost after restarting docker swarm.

Is there a way to make the secrets persist after restarting docker swarm in a 1 node cluster? If I have to mount files with these secrets from the host system, the files can not have values visible in plain text.

Is there an idiomatic way to do this in docker?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.