Docker Community Forums

Share and learn in the Docker community.

Stack environment sharing

(Peterlauri) #1

I have two services in my stack file that actually share same set of environment variables, now I have to duplicate that information in the stack file. Is there any way to define common environment variables? I know about the possibility to set environment variables when using docker-cloud cli, but that would mean I have to wrap the docker-cloud command with a bash script or similar, and store the environment variables there.

Is there any nice way to share environment variables in the stack file?

(Geoff Bowers) #2

Not at this time.

You might couple this wish with a nice way to share secrets in a stack file.

(Peterlauri) #3

Sure I could have the environment variables in my shell, and use empty variables. However, it causes me to be sure to have those environment variables set to the right values, depending on staging/production environment. I could wrap it in a shell script, that sets up the env vars, but… :slight_smile: