2

I have a docker swarm and I deploy my service stack using

"docker stack deploy --compose-file mycompose.yaml myservice".

I want to pass some values that will be using in this yaml file. Can I pass it from command line or through some other way?

curiousengineer
  • 2,196
  • 5
  • 40
  • 59

1 Answers1

1

With the old docker-compose you could create an .env file and expose environmental variables to the containers that way. Referencing ${env} in the .yml file. It seems swarm does something similar, not sure about the .env file tho. I'm still working on getting a swarm setup so I'm stuck on compose for now. I found these but haven't tried it myself yet, good luck.

https://docs.docker.com/compose/environment-variables/

And this too!
https://docs.docker.com/engine/swarm/secrets/

Shawn K
  • 779
  • 5
  • 13