[openstack-dev] [Nova][Docker] Environment variables

Daniel Kuffner daniel.kuffner at gmail.com
Mon Dec 16 14:27:03 UTC 2013


Hi All,

I have submitted a new blueprint which addresses the a common pattern
in the docker world. A usual pattern in the docker world is to use
environment variables to configure a container.

docker run -e "SQL_URL=postgres://user:password@/db" my-app

The nova docker driver doesn't support to set any environment
variables. To work around this issue I used cloud-init which works
fine. But this approach has of course the drawback that a) I have to
install the cloud init service. and b) my docker container doesn't
work outside of openstack.

I propose to allow a user to set docker environment variables via nova
instance metadata. The metadata key should have a prefix like ENV_
which can be used to determine all environment variables. The prefix
should be removed and the remainder key and vaule will be injected.

The metadata can unfortunately not be set in horizon but can be used
from the nova command line tool and from heat. Example heat:

myapp:
    Type: OS::Nova::Server
    Properties:
      flavor: m1.small
      image: my-app:latest
      meta-data:
        - ENV_SQL_URL: postgres://user:password@/db
        - ENV_SOMETHING_ELSE: Value


Let me know what you think about that.

Blueprint: https://blueprints.launchpad.net/nova/+spec/docker-env-via-meta-data

regards,
Daniel



More information about the OpenStack-dev mailing list