方法一:PIP安裝
聽說推薦使用pip安裝docker-compose,因爲pip可以爲你自動對應版本問題
安裝pip
yum -y install epel-release
yum -y install python-pip
確認版本
pip --version
更新pip
pip install --upgrade pip
安裝docker-compose
pip install docker-compose
查看版本
docker-compose version
如果執行報錯You are using pip version 8.1.2, however version 19.3.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
根據提示執行:sudo pip install --upgrade pip
,報錯如下:
ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443):
pip install默認超時時間是15s,由於中國qiang的原因,在安裝的過程中可能會超時,所以我們在執行命令時,可顯式指定超時時間,如下:
pip --default-timeout=100 install --upgrade pip
還是很慢?換國內源:
pip install -i https://pypi.douban.com/simple pip
如果報錯:
ERROR: docker-compose 1.24.1 has requirement requests!=2.11.0,!=2.12.2,!=2.18.0,<2.21,>=2.6.1, but you'll have requests 2.22.0 which is incompatible.
ERROR: rtslib-fb 2.1.69 has requirement pyudev>=0.16.1, but you'll have pyudev 0.15 which is incompatible.
ERROR: ipapython 4.6.5 has requirement python-ldap>=3.0.0b1, but you'll have python-ldap 2.4.15 which is incompatible.
更新版本即可:
pip install -i https://pypi.douban.com/simple --upgrade pyudev
方法二
這個方法比較慢,畢竟從github上下載的。。。
#下載docket-compose
curl -L https://github.com/docker/compose/releases/download/1.25.0-rc4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
#修改權限
chmod +x /usr/local/bin/docker-compose
上github搜索docker compose,第一個進去找到releases模塊,各個版本的鏈接都在這https://github.com/docker/compose/releases
。安裝提示安裝即可。