CentOS7下安裝Docker-Compose操作記錄

散盡浮華發表於2018-05-25

 

Docker-Compose是一個部署多個容器的簡單但是非常必要的工具.安裝Docker-Compose之前,請先安裝 python-pip

一、安裝 python-pip
[root@workbench-test ~]# pip -V
-bash: pip: command not found
 
[root@workbench-test ~]# yum install python-pip
[root@workbench-test ~]# yum -y install epel-release
[root@workbench-test ~]# yum install python-pip
[root@workbench-test ~]# pip install --upgrade pip
 
[root@workbench-test ~]# pip -V
pip 10.0.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)
 
二、安裝Docker Compose
[root@workbench-test ~]# pip install docker-compose
---------------------------------------------------------------------------------------
如果報錯:
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out
解決:
# pip --default-timeout=200 install -U docker-compose
--------------------------------------------------------------------------------------
如果執行中報錯:
Setup script exited with error: command 'gcc' failed with exit status 1異常
 
這是沒有正確安裝Python開發環境導致,解決如下:
# yum install python-devel
# yum install libevent-devel
# pip install gevent
# yum install groupinstall 'development tools' 
--------------------------------------------------------------------------------------
 
檢驗docker-compose是否安裝成功
[root@workbench-test ~]# docker-compose --version
docker-compose version 1.21.2, build a133471
--------------------------------------------------------------------------------------
如果報錯:
pkg_resources.DistributionNotFound: backports.ssl-match-hostname>=3.5 
解決方法:更新backports.ssl-match-hostname的版本,在終端輸入命令
# pip install --upgrade backports.ssl_match_hostname

相關文章