settingsLogin | Registersettings

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

0 votes

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openstack.org/pipermail/openstack-dev/attachments/20140812/e7844b54/attachment.html

asked Aug 12, 2014 in openstack-dev by Jay_Lau (7,320 points)   1 8 11
retagged Apr 14, 2015 by admin

6 Responses

0 votes

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
responded Aug 12, 2014 by Qiming_Teng (7,380 points)   3 9 14
0 votes

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 :

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:

responded Aug 12, 2014 by Jay_Lau (7,320 points)   1 8 11
0 votes

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 :

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
responded Aug 12, 2014 by Qiming_Teng (7,380 points)   3 9 14
0 votes

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
dependson: [database]
properties:
image: wordpress
links:
db: mysql
port
bindings:
80/tcp: [{"HostPort": "80"}]
dockerendpoint:
str
replace:
template: http://host:2345/
params:
host: {getattr: [dockerhost, networks, private, 0]}
cmd: "/bin/bash" <<<<<<<

2014-08-12 17:11 GMT+08:00 Qiming Teng :

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 :

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:

responded Aug 12, 2014 by Jay_Lau (7,320 points)   1 8 11
0 votes

On Tue, Aug 12, 2014 at 5:53 AM, Jay Lau <jay.lau.513 at 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
dependson: [database]
properties:
image: wordpress
links:
db: mysql
port
bindings:
80/tcp: [{"HostPort": "80"}]
dockerendpoint:
str
replace:
template: http://host:2345/
params:
host: {getattr: [dockerhost, 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.

--
Regards,
Eric Windisch
-------------- next part --------------
An HTML attachment was scrubbed...
URL:

responded Aug 12, 2014 by ewindisch_at_docker. (920 points)   1
0 votes

Thanks Eric for the confirmation ;-)

2014-08-12 23:30 GMT+08:00 Eric Windisch :

On Tue, Aug 12, 2014 at 5:53 AM, Jay Lau <jay.lau.513 at 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
dependson: [database]
properties:
image: wordpress
links:
db: mysql
port
bindings:
80/tcp: [{"HostPort": "80"}]
dockerendpoint:
str
replace:
template: http://host:2345/
params:
host: {getattr: [dockerhost, 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.

--
Regards,
Eric Windisch


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:

responded Aug 12, 2014 by Jay_Lau (7,320 points)   1 8 11
...