Installing the Docker Plugin for Heat31 July 2014 · Filed in Tutorial
In this post, I’ll share with you how I installed the Docker plugin for OpenStack Heat, so that Heat is able to orchestrate the creation of Docker containers in an OpenStack environment. I’m publishing this because I found the default instructions to be a bit too vague to be helpful. By sharing my experience, I hope that others interested in using Docker in their OpenStack environment will benefit.
Here are the steps I used to make the Docker plugin work with Heat. These steps assume you are using Ubuntu and already have OpenStack Heat installed and working correctly:
If you are using the packaged version of Heat (in other words, you are installing Heat via a method like
apt-get installon Ubuntu), then you’ll want to use the “stable/icehouse” branch that contains the Docker container. In this case, you don’t want to use master—it won’t work (either the plugin won’t load or the Heat engine service won’t start). Download a ZIP copy of the correct branch of Heat from GitHub (for “stable/icehouse”, see here).
contrib/dockerfolder from the downloaded ZIP copy of Heat.
contrib/docker/docker/testsdirectory; in my testing, the plugin failed to load if you leave this directory present in the plugin.
contrib/dockerfolder to your OpenStack controller somewhere. On my controller, I chose to put it into an existing
/var/lib/heatdirectory. When you’re done, you should have a
dockerdirectory in your chosen destination, and that directory should container another subdirectory named
docker. For example, on my system, the full path to the plugin was
/var/lib/heat/docker/docker. Make note of the full path.
In the top-level
pip install -r requirements.txt. Note that you might need to do an
apt-get install python-pipfirst. This will install the docker-py Python module, which is required by the Docker plugin.
Modify your Heat configuration file (typically found at
/etc/heat/heat.conf) and add the full path of the Docker plugin to the
plugin_dirssetting. If you used
/var/lib/heatas the base directory for the plugin, then the full path should be
Restart the Heat engine (via something like
sudo service heat-engine restartor similar).
heat resource-type-listand verify that DockerInc::Docker::Container is listed in the results. If not, verify that you have the correct path to the plugin specified in the Heat configuration file, and verify that you used the correct branch of the Docker plugin (“stable/icehouse” if you are using packaged versions of OpenStack). Review the Heat log files for any errors if the resource type still isn’t listed.
Assuming you were successful, then you are ready to start deploying Docker containers via Heat. Stay tuned for an example Heat template that shows how to deploy a Docker container. Until then, feel free to share any corrections, clarifications, or questions in the comments below.Tags: Automation · Docker · Linux · OpenStack · Virtualization Previous Post: Giving Back to the Community Next Post: A Quick Introduction to CoreOS