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

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


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.


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