Docker Community Forums

Share and learn in the Docker community.

Can I pass environment variables to service in swarm


(Hhakimi) #1

Hi,

Can I pass in environment variable when creating a service in swarm (when running it as a container as we can pass to “docker run” through -e switch)? I am experimenting with docker image in swarm mode and the container image expects certain parameter to fed in as environment variables.

Help on this is appreciated.

Thanks in advance.


(Hhakimi) #2

I think the way to do it is by using in --env during service time creation.