Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portainer Secrets cannot be found by Stack Compose File #11950

Open
2 tasks done
M0n7y5 opened this issue Jun 17, 2024 · 2 comments
Open
2 tasks done

Portainer Secrets cannot be found by Stack Compose File #11950

M0n7y5 opened this issue Jun 17, 2024 · 2 comments
Labels

Comments

@M0n7y5
Copy link

M0n7y5 commented Jun 17, 2024

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
image

Relevant stack file part:
image

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.
image

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

@jamescarppe
Copy link
Member

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).

@M0n7y5
Copy link
Author

M0n7y5 commented Jul 1, 2024

@jamescarppe i think i tried this first tho i may miss-configured something. I'll try again and see if that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants