If you do not need docker swarm or k8s, but you really want to use docker secret, you have the alternative of use this project.
You need assign two environment:
- "DIR_SECRET=/secret"
- "SECRET=MYSQL_PASSWORD_FILE,MYSQL_ROOT_PASSWORD_FILE,CERT_EXAMPLE"
The environment DIR_SECRET means where your secret will be saved, and the environment SECRET will be split into an array which contains your secret file name.
If the environment SECRET contains a value starts from "CERT", this container will generate a pair of certificate and key.
For example, if SECRET=CERT_EXAMPLE, there will be two files called EXAMPLE.CRT and EXAMPLE.key generated under DIR_SECRET.
The secrets will be generated randomly if secrets is not exists in DIR_SECRET otherwise not.
you can see an example here:
you can pull compiled images here:
if you want to test your code, you can use environment DEVELOPMENT and set volume "/tmp/secret:/tmp/secret",
we will copy all secrets to /tmp/secret/, and set the permission of dir /tmp/secret
to 0755.
you can see example here: