Docker-compose secrets won't load DEBUG env

107 Views Asked by At

I am using the following code in a docker-compose.yml file.

I also start the container with "docker stack deploy -c docker-compose.yml default" in windows command prompt.

Swarm is active.

For the love of god (got to be honest, I've started my studies in this field not so long ago) I can not figure out why the DEBUG env will always set to " /run/secrets/debug" string and not the actual value of the secret key.

I've checked the live containe, and it does contain the debug file in /run/secrets, and if i run "cat debug" I get the secret value back.

Can anyone help me?

Code below:

version: '3.9'
services:
  portfolio:
    image: kcisijohnny/portfolio
    build: portfolio
    ports:
      - '5000:5000'
    networks:
      - portfolio_network
    environment:
      DEBUG: /run/secrets/debug
    secrets:
      - debug
secrets:
  debug:
    external: true
    name: debug

I've tried every variation I foud online in the docker-compose.yml: DEBUG: cat /run/secrets/debug DEBUG: cat "/run/secrets/debug"

  • DEBUG=$(cat /run/secrets/debug)
  • DEBUG=$$(cat /run/secrets/debug) non if these worked.
0

There are 0 best solutions below