Can I pass environment variables to service in swarm


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.

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