Managing Docker Containers with OpenStack (1)

[Editor's Note] This article will explain how to use OpenStack to create and manage Docker, there are three popular use, using the Nova Docker driver, Heat Docker plug-in, and Magnum. This article is divided into two parts, the first part, will introduce the Nova Docker driver usage. The second part is about the Heat Docker plugin and Magnum. This is the first part of the sequence article.

In this article, I will introduce a number of different methods on how OpenStack is created and how to manage Docker containers. The three main methods are the Nova Docker driver, the Heat Docker plugin, and the Magnum. Magnum is novel and is still under development. OpenStack is open source cloud layout software, Docker is an open source container management software. In the article, I assume that the user is already familiar with OpenStack and Docker. If you are not familiar with it, then there are many online information can be used to learn OpenStack and Docker, my blog can also find articles on OpenStack and Docker .

Nova Docker Driver

Nova is usually used to manage virtual machines. In this approach, the Nova driver will be extended to spawn the Docker container. Next is the schema diagram mentioned in the Nova Docker wiki.


  • In order to spawn the container, the Nova calculation driver will point to the Docker.
  • Nova Docker Virt driver uses http api to talk to Docker
  • The Docker image is stored in the Docker Registry and exposed from here to Glance, and Nova will create the container using Docker Registry.

Nova Docker Drive with Devstack

I follow the steps mentioned in the wiki and get the Nova Docker driver under OpenStack Devstack kilo. In order to make it possible to work under my system, to make some mirror adjustments. I use Ubuntu 14.04 under Virtualbox for the following tests, here are some of the main steps:

  1. Install Docker
  2. Install the Nova Docker plugin
  3. Perform a stack of Devstack
  4. Install the Nova-Docker rootwrap filter
  5. Apply Kilo solution
  6. Create a Docker image and expose it to Glance
  7. The Docker container was born by Nova

1. Install Docker

The Docker can be installed using the steps mentioned here . The following is the version used on my system, I have opened the user access, so I do not need to run sudo in each Docker command.

  $ Docker --version 
Docker version 1.6.2, build 7c8fca2

2. Install the Nova Docker plugin

Wiki mentioned inside the steps can work well. When I was looking at the driver, I was using a stable version of kilo.

  Git clone -b stable / kilo 

The following is the version number of the Nova Docker plugin after the installation is successful

  $ Sudo pip list | grep nova-docker 
Nova-docker (0.0.1.dev197)

3. Perform a stack of Devstack

First, check Devstack Kilo's code base.

  Git clone -b stable / kilo 

I have slightly modified the local.conf file, the modified version here . Next is the stack.

  Cd devstack; ./ 

4. Install the Nova-Docker rootwrap filter

Wiki mentioned inside the steps can work well.

  Sudo cp nova-docker / etc / nova / rootwrap.d / docker.filters \ 

5. Apply Kilo solution

The stack throws the following error:

  2015-06-03 22: 28: 57.870 ERROR nova.openstack.common.threadgroup [req-f89bc2cd-5fcc-42e4-a588-ef92ab101fb3 None None] 'module' object has no attribute 'DOCKER' 
Nuncles nova

The OpenStack mailing list discussed this issue, the solution is to edit the Docker driver file. In my case, the file is located at "/usr/local/lib/python2.7/dist-packages/novadocker/virt/docker".

6. Create a Docker image and expose it to Glance

I first use the "docker pull nginx" command to grab the Nginx container from the Docker Hub

  $ Docker images 
Nginx latest a785ba7493fd 2 weeks ago 132.9 MB

Next, save the image to Glance.

  Docker save nginx | ​​glance image-create --is-public = True --container-format = docker --disk-format = raw --name nginx 

Now, look at the Glance mirror list, we can see that the Docker image has been mirrored with other instances, and the type of Nginx is Docker.

7. Docker containers were born by Nova

We use the mirror in Glance to create a nginx container. Flavor is not really important.

  Nova boot --flavor m1.small --image nginx nginxtest 

View the Docker container that is running inside the host.

  $ Docker ps 
4f514bc59a41 nginx: latest "nginx -g 'daemon of 12 seconds ago Up 11 seconds nova-931335f8-ac5c-4c28-967b-25b9474ab2de

List Nova example:

 $ Nova list 
+ -------------------------------------- + ---------- - +---- + ------------ + ------------- + ------------ ------ +
ID | Name | Status | Task State | Power State | Networks |
+ -------------------------------------- + ---------- - +---- + ------------ + ------------- + ------------ ------ +
| 931335f8-ac5c-4c28-967b-25b9474ab2de | nginxtest | ACTIVE | - | Running | private = |
+ -------------------------------------- + ---------- - +---- + ------------ + ------------- + ------------ ------ +

Check that nginx is working properly:

  $ Curl to nginx! 

Thanks for using nginx.


  • OpenStack Docker Wiki
  • Nova Docker with Devstack
  • Nova Docker github page
  • Practical Docker for OpenStack presentation

Note: The images used in the article come from the articles in the reference list.

Original link: OpenStack with Docker-part 1 (translation: Hong Guoan reviser: Li Yingjie)

Translator introduced Hong Guoan, programming enthusiasts, is currently a junior student, hoping to help the community through the translation, to improve their knowledge.

    Heads up! This alert needs your attention, but it's not super important.