Open M0n7y5 opened 2 months ago
If you have created a secret outside of the stack file you need to add the secret as external
so that Docker knows to use the existing one. This is done through a separate secrets:
section in the stack file, the same way you would do volumes. A simple example stack file might look like this:
version: "3"
services:
nginx:
image: nginx:latest
secrets:
- my_secret
secrets:
my_secret:
external: true
You reference the secret (my_secret
) in the service as usual, but you also need to add the secrets
section. Note if you are creating a secret as part of the stack, you would need to include this section as well (just without the external: true
option).
@jamescarppe i think i tried this first tho i may miss-configured something. I'll try again and see if that helps.
Before you start please confirm the following.
Problem Description
Unable to use secrets defined in Portainer UI in docker compose file when creating or updating Stack. Every time i try to do so i get error message saying undefined secret
Here secrets UI
Relevant stack file part:
Expected Behavior
Being able to use my secrets defined in Portainer
Actual Behavior
Every time i try to use already defined secret then i get error message saying undefined secret.
Steps to Reproduce
Create any secret in Portainer UI and try to using while creating Service Stack
Portainer logs or screenshots
No response
Portainer version
2.19.5
Portainer Edition
Community Edition (CE)
Platform and Version
Docker Swarm 26.1.3
OS and Architecture
Ubuntu jammy 22.04 x86_64
Browser
No response
What command did you use to deploy Portainer?
No response
Additional Information
No response