Adding docker as virtualzation driver in Openstack
# yum install python-pbr python-pip
# yum install docker-io -y
# git clone https://github.com/stackforge/nova-docker
# cd nova-docker
# git checkout stable/juno
# python setup.py install
# systemctl start docker
# systemctl enable docker
Now enable docker in nova and glance
cp /etc/nova/nova.conf /etc/nova/nova.conf.orig
diff /etc/nova/nova.conf /etc/nova/nova.conf.orig
2006
,2009c2006
< #compute_driver=nova.virt.libvirt.LibvirtDriver
<
< #Changed by Juned
< compute_driver = novadocker.virt.docker.DockerDriver
---
> compute_driver=nova.virt.libvirt.LibvirtDriver
cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.orig
[root
@ggvaapp08
nova-docker(keystone_admin)]# diff /etc/glance/glance-api.conf /etc/glance/glance-api.conf.orig
108
,110d107
< #Added By JunedM
< container_formats=ami,ari,aki,bare,ovf,ova,docker
Also make sure the docker api version for server and client are same otherwise nova will not start.
[root@tiber ~]# docker version
Client version: 1.3.2
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 39fa2fa/1.3.2
OS/Arch (client): linux/amd64
Server version: 1.3.2
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 39fa2fa/1.3.2
Client version: 1.3.2
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 39fa2fa/1.3.2
OS/Arch (client): linux/amd64
Server version: 1.3.2
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 39fa2fa/1.3.2
Docker Client is docker-py
[root@tiber~]# pip list | grep docker
docker-py (1.0.0)
nova-docker (0.0.0.post140)
docker-py (1.0.0)
nova-docker (0.0.0.post140)
>>> from docker import Client
>>> c = Client(base_url='unix://var/run/docker.sock')
>>> c.containers()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/docker/client.py", line 423, in containers
res = self._result(self._get(u, params=params), True)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 123, in _result
self._raise_for_status(response)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 119, in _raise_for_status
raise errors.APIError(e, response, explanation=explanation)
docker.errors.APIError: 404 Client Error: Not Found ("client and server don't have same version (client : 1.17, server: 1.15)")
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>>
>>> c = Client(base_url='unix://var/run/docker.sock')
>>> c.containers()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/docker/client.py", line 423, in containers
res = self._result(self._get(u, params=params), True)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 123, in _result
self._raise_for_status(response)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 119, in _raise_for_status
raise errors.APIError(e, response, explanation=explanation)
docker.errors.APIError: 404 Client Error: Not Found ("client and server don't have same version (client : 1.17, server: 1.15)")
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>>