安装 docker-compose
方法一: 二进制文件安装
我们可以在https://github.com/docker/compose/releases
获取更多的二进制文件
- 安装和添加执行权限命令
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- 如下表示安装成功
[root@localhost ~]# sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/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 832 0 --:--:-- --:--:-- --:--:-- 832
100 10605k 100 10605k 0 0 245k 0 0:00:20 0:00:20 --:--:-- 10605k
[root@localhost ~]# sudo chmod +x /usr/local/bin/docker-compose
- 查看是否安装成功
[root@localhost ~]# docker-compose -version
docker-compose version 1.21.2, build a133471
方法二: pip安装
很多时候使用二进制方法安装不成功,我们可以使用python的pip
方法进行安装
- 先安装python-pip
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y install python-pip
[root@localhost ~]# pip --version # 查看版本
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
- 安装
docker-compose
[root@localhost ~]# pip install docker-compose
卸载docker-compose
docker-compose卸载只需要删除二进制文件就可以了。
sudo rm /usr/local/bin/docker-compose