On Tue, Aug 12, 2014 at 5:53 AM, Jay Lau <jay.lau....@gmail.com> wrote:

> I did not have the environment set up now, but by reviewing code, I think
> that the logic should be as following:
> 1) When using nova docker driver, we can use cloud-init or/and CMD in
> docker images to run post install scripts.
> myapp:
>     Type: OS::Nova::Server
>         Properties:
>             flavor: m1.small
>             image: my-app:latest  <<<<< docker image
>             user-data: xxxx <<<<<<<<<<<
> 2) When using heat docker driver, we can only use CMD in docker image or
> heat template to run post install scripts.
> wordpress:
>     type: DockerInc::Docker::Container
>     depends_on: [database]
>     properties:
>       image: wordpress
>       links:
>         db: mysql
>       port_bindings:
>         80/tcp: [{"HostPort": "80"}]
>       docker_endpoint:
>         str_replace:
>           template: http://host:2345/
>           params:
>             host: {get_attr: [docker_host, networks, private, 0]}
>             cmd: "/bin/bash" <<<<<<<

I can confirm this is correct for both use-cases. Currently, using Nova,
one may only specify the CMD in the image itself, or as glance metadata.
The cloud metadata service should be assessable and usable from Docker.

The Heat plugin allow settings the CMD as a resource property. The
user-data is only passed to the instance that runs Docker, not the
containers. Configuring the CMD and/or environment variables for the
container is the correct approach.

Eric Windisch
OpenStack-dev mailing list

Reply via email to