Eric
Eric

Reputation: 768

Is it possible to use cloud-init and heat-cfntools inside a Docker container?

I want to use OpenStack Heat to create an application which consists of several Docker containers, and monitor some metrics of these containers, like: CPU/Mem utilization, and other application-specific metrics.

So is it possible to install cloud-init and heat-cfntools when prepare the Docker image via Dockerfile, and then run a Docker container based on the image which has cloud-init and heat-cfntools running in it?

Thanks!

Upvotes: 1

Views: 1013

Answers (2)

Andy
Andy

Reputation: 38337

If your tools require monitoring processes on the host, you'll probably want to run with

docker run --pid=host

This is a feature introduced in Docker Engine version 1.5.

See http://docs.docker.com/reference/run/#pid-settings

Upvotes: 0

larsks
larsks

Reputation: 312430

So is it possible to install cloud-init and heat-cfntools when prepare the Docker image via Dockerfile

It is possible to use cloud-init inside a Docker container, if you (a) have an image with cloud-init installed, (b) have the correct commands configured in your ENTRYPOINT or CMD script, and (c) your container is running in an environment with an available metadata service.

Of those requirements, (c) is probably the most problematic; unless you are booting containers using the nova-docker driver, is is unlikely that your containers will have access to the Nova metadata service.

I am not particularly familiar with heat-cfntools, although a quick glance at the code suggests that it may work without cloud-init by authenticating against the Heat CFN API using ec2-style credentials, which you would presumably need to provide via environment variables or something.

That said, it is typically much less necessary to run cloud-init inside Docker containers, the theory being that if you need to customize an image, you'll use a Dockerfile to build a new one based on that image and re-deploy, or specify any necessary additional configuration via environment variables.

Upvotes: 3

Related Questions