Using secrets in portainer

This is a quick post on how to use docker secrets with portainer. We will use the pgadmin service as an example to demonstrate this.

Login to the portainer and navigate to the secrets landing page. Then click on create secrets as shown below.

After saving the secret go to the stacks and create new stack to use the secret. We are going to keep thing simple, will add a stack with only one service for pgadmin and will connect to the external postgres database.

The docker secrets are mounted to the files in the path /run/secrets/* and you can see the unencrypted values if you run commands inside the container. Also note that we use _FILE ext in the env variable to read the content of the secret file, if not the file path will be used as password as it is instead of the secret.


Leave a Reply

Your email address will not be published. Required fields are marked *