[openstack-dev] [OpenStack][Docker][HEAT] Cloud-init and docker container

Jay Lau jay.lau.513 at gmail.com
Tue Aug 12 09:53:36 UTC 2014


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" <<<<<<<



2014-08-12 17:11 GMT+08:00 Qiming Teng <tengqim at linux.vnet.ibm.com>:

> Don't have an answer to this.  You may try it though.
>
> Regards,
>   Qiming
>
> On Tue, Aug 12, 2014 at 04:52:58PM +0800, Jay Lau wrote:
> > Thanks Qiming. ;-)
> >
> > Yes, this is one solution for running user data when using docker
> container
> > in HEAT. I see that the properties include almost all of the parameters
> > used in "docker run".
> >
> > Do you know if docker container support cloud-init in a image? My
> > understanding is NOT as I did not see "userdata" in docker property.
> >
> >
> >
> > 2014-08-12 16:21 GMT+08:00 Qiming Teng <tengqim at linux.vnet.ibm.com>:
> >
> > >
> > > Hi,
> > >
> > > Are you aware of the dockter_container resource type
> > > (DockerInc::Docker::Container) in Heat contrib directory? I am seeing a
> > > 'CMD' property which is a list of command to run after the container is
> > > spawned.
> > >
> > > Is that what you want?
> > >
> > > Regards,
> > >   Qiming
> > >
> > > On Tue, Aug 12, 2014 at 02:27:39PM +0800, Jay Lau wrote:
> > > > Hi,
> > > >
> > > > I'm now doing some investigation for docker + HEAT integration and
> come
> > > up
> > > > one question want to get your help.
> > > >
> > > > What is the best way for a docker container to run some user data
> once
> > > the
> > > > docker container was provisioned?
> > > >
> > > > I think there are two ways: using cloud-init or the "CMD" section in
> > > > Dockerfile, right? just wondering does anyone has some experience
> with
> > > > cloud-init for docker container, does the configuration same with VM?
> > > >
> > > > --
> > > > Thanks,
> > > >
> > > > Jay
> > >
> > > > _______________________________________________
> > > > OpenStack-dev mailing list
> > > > OpenStack-dev at lists.openstack.org
> > > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> > >
> > >
> > > _______________________________________________
> > > OpenStack-dev mailing list
> > > OpenStack-dev at lists.openstack.org
> > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> > >
> >
> >
> >
> > --
> > Thanks,
> >
> > Jay
>
> > _______________________________________________
> > OpenStack-dev mailing list
> > OpenStack-dev at lists.openstack.org
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



-- 
Thanks,

Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140812/c28d5ae6/attachment.html>


More information about the OpenStack-dev mailing list