一、下载二进制文件
[root@localhost ~]# curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 617 0 617 0 0 325 0 --:--:-- 0:00:01 --:--:-- 325 100 15.4M 100 15.4M 0 0 257k 0 0:01:01 0:01:01 --:--:-- 376k
二、赋予执行权限
[root@localhost ~]# chmod +x /usr/local/bin/docker-compose
此安装方法取自官方网站,centos7 上已测试验证
[root@localhost ~]# docker-compose version docker-compose version 1.24.0, build 0aa59064 docker-py version: 3.7.2 CPython version: 3.6.8 OpenSSL version: OpenSSL 1.1.0j 20 Nov 2018
三、docker-compose是python编写,因此可以通过pip安装
pip install docker-compose
四、docker-compose卸载
#如果是二进制包方式安装的,删除二进制文件即可: rm /usr/local/bin/docker-compose #如果通过Python pip工具安装的,则执行如下命令删除: pip uninstall docker-compose
五、其他
为了方便输入命令,也可以安装Docker的补全提示工具帮忙快速输入命令
yum install bash-completion
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose