CentOS 7 安装 Docker-Compose

一、安装步骤

  1. 添加企业版附加包。

    yum -y install epel-release
    
  2. 安装 PIP。

    yum -y install python-pip
    
  3. 更新 PIP。

    pip install --upgrade pip 

     

  4. 安装 Docker Compose

    pip install docker-compose
    

二、可能遇到的问题

1.yum -y install epel-release

failure: repodata/repomd.xml from epel: [Errno 256] No more mirrors to try.

 解决办法:

vim /etc/yum.repos.d/epel.repo 

修改如下:

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch

再次使用yum命令即正常! 命令如下:

yum clean all

yum makecache

yum update

yum -y install epel-release

 2 .yum -y install python-pip

第一次安装可能会报异常,重新再执行一次即可(亲测)

第二次执行命令后:

在执行 pip install docker-compose 命令的时候可能会提示以下内容:

Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

这个时候,你需要执行以下命令强制重新安装 request。

pip install -I requests==2.9

安装完成之后,Docker-Compose 安装成功。

3 .pip install docker-compose

Could not build wheels for dockerpty, since package 'wheel' is not installed.

pip install wheell即可

三、二进制安装#

  1. 下载最新版的 docker-compose 二进制执行文件。

    sudo curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
    
  2. 配置可执行权限。

    sudo chmod +x /usr/local/bin/docker-compose
    
  3. 测试是否安装成功。

    docker-compose --version 

  1. 添加企业版附加包。

    yum -y install epel-release
    
  2. 安装 PIP。

    yum -y install python-pip
    
  3. 更新 PIP。

    pip install --upgrade pip 

     

  4. 安装 Docker Compose

    pip install docker-compose
    

二、可能遇到的问题

1.yum -y install epel-release

failure: repodata/repomd.xml from epel: [Errno 256] No more mirrors to try.

 解决办法:

vim /etc/yum.repos.d/epel.repo 

修改如下:

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch

再次使用yum命令即正常! 命令如下:

yum clean all

yum makecache

yum update

yum -y install epel-release

 2 .yum -y install python-pip

第一次安装可能会报异常,重新再执行一次即可(亲测)

第二次执行命令后:

在执行 pip install docker-compose 命令的时候可能会提示以下内容:

Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

这个时候,你需要执行以下命令强制重新安装 request。

pip install -I requests==2.9

安装完成之后,Docker-Compose 安装成功。

3 .pip install docker-compose

Could not build wheels for dockerpty, since package 'wheel' is not installed.

pip install wheell即可

三、二进制安装#

  1. 下载最新版的 docker-compose 二进制执行文件。

    sudo curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
    
  2. 配置可执行权限。

    sudo chmod +x /usr/local/bin/docker-compose
    
  3. 测试是否安装成功。

    docker-compose --version 

猜你喜欢

转载自www.cnblogs.com/adao21/p/12901408.html