标签:
一、系统环境版本介绍:
os-version: Linux 3.10.0-229.el7.x86_64 python-version: Python 2.7.5 six-version: python-six-1.3.0-4.el7.noarch docker-version: docker-1.6.2-14.el7.centos.x86_64 docker-py version: 1.1.0
二、docker-py配置安装:
源码从github上下载:https://github.com/docker/docker-py.git
下载后选择版本:
$ git tag #view the available tags
$ git checkout tags/1.1.0 #checkout the tag of version
三、启动docker服务,测试安装是否成功:
$ service docker start
[root@docker docker-py]# python Python 2.7.5 (default, Jun 17 2014, 18:11:42) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from docker import Client >>> c = Client(base_url=‘unix://var/run/docker.sock‘) >>> c.images(all=True) [{u‘Created‘: 1437311326, u‘Labels‘: {}, u‘VirtualSize‘: ...]
四、问题探讨:
(1)docker-py当前开发版似乎对python2.7支持不够,出现如下报错:
(2)用pip安装docker-py更加是不靠谱,提示找不到urllib库,难道要在python3上面装这个么?
标签:
原文地址:http://www.cnblogs.com/forilen/p/4730562.html