openshift / geard

geard is no longer maintained - see OpenShift 3 and Kubernetes
Other
405 stars 80 forks source link

Defining environment variables #208

Closed capoferro closed 10 years ago

capoferro commented 10 years ago

I suspect this is me being new to working with gear, but I cannot figure out how to provide environment variables to my containers.

What is the correct way of setting environment variables, equivalent to -e from docker run?

sajmoon commented 10 years ago

On the github page for geard they have an example:

"$ gear install ccoleman/envtest localhost/env-test1 --env-file=deployment/fixtures/simple.env

Loading environment into a running container is dependent on the "docker run --env-file" option in Docker master from 0.9.x after April 1st. You must start the daemon with "gear daemon --has-env-file" in order to use the option - this option will be made the default after 0.9.1 lands and the minimal requirements will be updated."

One example of an .env file can be found in the repo itself: https://github.com/openshift/geard/blob/master/deployment/fixtures/simple.env

smarterclayton commented 10 years ago

You can also set env via

$ gear install openshift/busybox-http-app localhost/myservice A=B B=C C=D
capoferro commented 10 years ago

Thanks for the notes. I had tried --env-file but I must have been doing something wrong. Is there a way to define environment variables via the json definition of containers?

capoferro commented 10 years ago

[edit] I'm an idiot, I missed the note about starting the gear daemon with --has-env-file

Thanks all!

smarterclayton commented 10 years ago

bluepojo the default has now been changed to be "true" (but it's not in the Fedora packages yet I don't think) since Docker landed their env file support.