1. 卸载docker
#卸载之前的docker旧版本
[root@xjjc1 ~]# yum -y remove docker-engine
#镜像, 容器, volumes, 配置文件 都不会自动删除. 需要手动删除,如果确定不需要可以执行以下命令:
[root@xjjc1 ~]# rm -rf /var/lib/docker/ #删除docker相关手动配置
2. yum安装docker1.13.1
#rmp安装方式
[root@xjjc1 ~]# yum -y install https://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-1.13.1-1.el7.centos.x86_64.rpm
#启动docker
[root@xjjc1 ~]# systemctl start docker
#开机启动
[root@xjjc1 ~]# systemctl enable docker
3. 查看docker版本
[root@xjjc1 ~]# docker version
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:38:28 2017
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:38:28 2017
OS/Arch: linux/amd64
Experimental: false
4. 安装docker-compose
#更新epel
[root@xjjc1 ~]# yum -y install epel-release
#安装pip
[root@xjjc1 ~]# yum install python-pip -y
#对安装好的pip进行升级
[root@xjjc1 ~]# pip install --upgrade pip
#安装docker-compose
[root@xjjc1 ~]pip install docker-compose
5. 查看docker-compose版本
[root@xjjc1 ~]# docker-compose -version
docker-compose version 1.12.0, build b31ff33
6. 注意事项:
#执行完之后,输入docker-compse,若报如下错误:
[root@localhost ~]# docker-compose
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3011, in <module>
parse_requirements(__requires__), Environment()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 626, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: backports.ssl-match-hostname>=3.5
解决方法:在终端输入命令
pip install --upgrade backports.ssl_match_hostname
Windows/Linux 安装pip
到pip的官网:
https://pip.pypa.io/en/latest/installing.html#python-os-support
找到 Install pip这一节,里面提供了一个脚本,叫 get-pip.py,不管是windows还是linux直接用python跑一下就可以了,
什么setuptools之类的,全部自动帮你装好,非常方便。
脚本下载地址:
https://bootstrap.pypa.io/get-pip.py
参考: