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

[BUG] Combining include and secrets leads to validation errors when secrets are set environment variables #12228

Closed
lassebe opened this issue Oct 22, 2024 · 2 comments

Comments

@lassebe
Copy link

lassebe commented Oct 22, 2024

Description

When defining a environment based secret in an "inner" compose file, compose reports a validation error.
However, this only occurs if the environment variable is actually set.

I would expect to be able to include compose files that define top-level environment secrets.
Hopefully I've just made some other mistake!

Steps To Reproduce

Tried to make this a minimal example.
Encountered in a situation with a service that actually references the secret, but given that it is blowing up earlier this should hopefully be sufficient to reproduce.

docker-compose.yml

include:
  - path:
      - ./app/docker-compose.yml

./app/docker-compose.yml

secrets:
  some-secret:
    environment: "MY_ENV_VAR"

If I run

export MY_ENV_VAR="anything"
docker compose config

I get the following error

validating /.../compose-test/docker-compose.yml: secrets.some-secret Additional property content is not allowed

If I then run

unset MY_ENV_VAR
docker compose config

It correctly returns a valid template

name: compose-test
services: {}

Similarly, running MY_ENV_VAR="anything" docker compose config inside app works perfectly, and outputs:

name: app
services: {}

Compose Version

docker compose version

Docker Compose version v2.29.2-desktop.2

docker-compose version

Docker Compose version v2.29.2-desktop.2

Docker Environment

Anything else?

No response

@ndeloof
Copy link
Contributor

ndeloof commented Oct 22, 2024

closing as a duplicate for #12033

@ndeloof ndeloof closed this as completed Oct 22, 2024
@lassebe
Copy link
Author

lassebe commented Oct 22, 2024

Ah, my bad, don't know how I missed that!

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

No branches or pull requests

2 participants