【问题标题】:install Docker CE 17.03 on RHEL7在 RHEL7 上安装 Docker CE 17.03
【发布时间】:2017-08-16 07:21:29
【问题描述】:

是否可以在 RHEL7 上安装特定版本 17.03 的 DockerCE ?

【问题讨论】:

标签: docker redhat


【解决方案1】:

我们有离线环境,所以我想办法一一安装所有需要的包。

  • 运行online.sh 脚本下载这些包。
  • 将这些包复制到您的服务器scp -r *.rpm my.server:/tmp
  • 转到您的服务器 cd /tmp,然后运行 ​​offline.sh 脚本。

【讨论】:

    【解决方案2】:

    来自@Matt Schuchard 和@Akash Srivastava

    将它们的命令组合在一起,我发现下面的命令行对我有用。

    sudo yum install -y yum-utils
    sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    sudo yum makecache fast
    sudo subscription-manager repos --enable rhel-7-server-extras-rpms
    sudo yum update
    sudo yum -y install docker-ce
    sudo systemctl start docker
    

    谢谢

    【讨论】:

      【解决方案3】:

      一次性开发测试 RHEL 7.3 的过程。切勿在生产环境中这样做。

      # pre-requisite for container-selinux-2.9-4.el7.noarch.rpm
      sudo yum install policycoreutils-python
      
      wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.107-3.el7.noarch.rpm
      sudo rpm -i container-selinux-2.21-1.el7.noarch.rpm
      
      #Set up the Docker CE repository on RHEL:
      sudo yum install -y yum-utils
      sudo yum install -y device-mapper-persistent-data lvm2
      sudo yum-config-manager --enable rhel-7-server-extras-rpms
      sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
      sudo yum makecache fast
      
      # Install the latest version of Docker CE on RHEL:
      sudo yum -y install docker-ce
      
      #Start Docker:
      sudo systemctl start docker
      
      #Test your Docker CE installation:
      sudo docker run hello-world
      
      # configure Docker to start on boot
      sudo systemctl enable docker
      
      # add user to the docker group 
      sudo usermod -aG docker jethro
      
      # install Docker Compose:
      # install python-pip
      wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
      
      sudo yum install ./epel-release-latest-7.noarch.rpm
      sudo yum install -y python-pip
      
      sudo pip install docker-compose
      
      # upgrade your Python packages:
      sudo yum upgrade python*
      

      以上假设您没有使用代理。如果是,则需要在/etc/yum.repos.d/ 下每个文件的每个块的末尾添加proxy=http://myproxy:myport 行,或将其添加到/etc/yum.conf

      希望这会有所帮助。

      【讨论】:

      • 您的解决方案完美运行!非常感谢!问题:为什么您不建议 PRD 使用相同的流程?那么 PRD 的正确流程是什么?
      • 您将需要并且需要生产环境中的 Docker 支持,尤其是在可扩展性问题方面。
      • container-selinux 部分已过时。使用:wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.21-1.el7.noarch.rpm; rpm -i container-selinux-2.21-1.el7.noarch.rpm
      • 这很接近,但是 AWS 上 RHEL 7 的官方 AMI 附带 d_type=0 的 xfs 文件系统,并且不会为我启动。 community.centminmod.com/threads/…
      • 最新版本sudo yum install policycoreutils-pythonwget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.74-1.el7.noarch.rpm; rpm -i container-selinux-2.74-1.el7.noarch.rpm
      【解决方案4】:

      对于那些面临以下错误的人:

      Error: Package: docker-ce-17.06.0.ce-1.el7.centos.x86_64 (docker-ce-stable)
             Requires: container-selinux >= 2.9
             You could try using --skip-broken to work around the problem
             You could try running: rpm -Va --nofiles --nodigest
      

      在 RHEL 7.3+ 上安装 docker 时,我们需要执行:

          sudo subscription-manager repos --enable rhel-7-server-extras-rpms
      

      这将允许在 yum update 上安装额外的 rpms。执行后:

          sudo yum update
      

      然后按照: Install Docker

      这对我有用。

      【讨论】:

      • 似乎从 Docker 18.03+ 开始,它需要额外的依赖 pigz- 遗憾的是它不在 Extras 中;但在 EPEL -> yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm:(
      • 执行subsciption-manager 命令,我得到一个连接被拒绝的错误:“网络错误,无法连接到服务器。有关详细信息,请参阅/var/log/rhsm/rhsm.log。”
      【解决方案5】:

      安装 Docker RHEL/CENTOS

      1. 转至:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

        下载:docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm 2018-06-08 05:48 19M 下载:docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm 2018-06-08 05:48 29K

        上传到服务器

        1. yum -y install docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm

        2. yum -y 安装 docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm

        3. sudo systemctl start docker

        4. 参考: install Docker CE 17.03 on RHEL7 https://nickjanetakis.com/blog/docker-tip-39-installing-docker-ce-on-redhat-rhel-7x https://docs.docker.com/install/linux/docker-ee/rhel/#set-up-the-repository

      【讨论】:

        【解决方案6】:

        我在运行 7.x 时遇到了同样的问题,我执行了以下操作:

        yum install -y yum-utils
        
        wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
        
        rpm -ivh epel-release-latest-7.noarch.rpm
        
        subscription-manager repos --enable=rhel-7-server-extras-rpms
        
        yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.55-1.el7.noarch.rpm
        
        yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
        
        yum install -y docker-ce
        
        systemctl restart docker
        

        有了这个,你就不会陷入 pigz 错误

        Error: Package: docker-ce-18.03.1.ce-1.el7.centos.x86_64 (docker-ce-stable)
                   Requires: pigz
         You could try using --skip-broken to work around the problem
        

        另外你需要留意 container-selinux,因为我使用的是 2.55-1 版本的直接链接

        【讨论】:

          【解决方案7】:

          也许您可以在 RHEL 7.3 上安装 Docker CE 17.06 或 17.03,但 Docker 文档非常清楚:

          RHEL 不支持 Docker 社区版 (Docker CE)。

          https://docs.docker.com/engine/installation/linux/docker-ee/rhel/

          【讨论】:

          • 你的咖啡机上都没有运行 Doom,但很高兴有这个选项。
          【解决方案8】:

          根据文档here,您可以通过以下方式在 RHEL 7.3 64 位上安装 Docker CE 17.03(或未来版本):

          在 RHEL 上设置 Docker CE 存储库:

          sudo yum install -y yum-utils
          sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
          sudo yum makecache fast
          

          在 RHEL 上安装最新版本的 Docker CE:

          sudo yum -y install docker-ce
          

          或者,您可以指定特定版本的 Docker CE:

          sudo yum -y install docker-ce-<version>-<release>
          

          启动 Docker:

          sudo systemctl start docker
          

          测试您的 Docker CE 安装:

          sudo docker run hello-world
          

          【讨论】:

          • 在 RHEL 上尝试手动安装 Docker CE 是否存在任何许可问题?这在法律上是否允许?
          • 这实际上不是手动安装,但除此之外,非企业版 Moby 是在 Apache 2.0 许可下发布的,因此安装和使用它没有许可问题。如果您从企业获取代码并重用它,或者在不付费的情况下使用企业,那么可能会出现许可问题。
          • 别忘了sudo systemctl enable docker,否则开机时服务不会自动启动。
          • 我的机器安装了 RPM docker-1.12.6-16-e17.x86_64,我得到了 Error: docker-ce conflicts with 2:docker-1.12.6-16.el7.x86_64 的错误。错误信息后有两个建议:1.You could try using --skip-broken to work around the problem和2.You could try running: rpm -Va --nofiles --nodigest。你会推荐什么?谢谢!
          • @leeyuiwah 你必须先卸载旧的 Docker RPM。出于某种原因,Docker(公司)忘记在其 RPM 元数据中使用 obsoletes 标签,因此 CE 不会像它应该的那样自动替换旧系列。
          猜你喜欢
          • 2018-06-05
          • 1970-01-01
          • 2018-01-07
          • 2018-12-07
          • 1970-01-01
          • 2022-07-15
          • 2019-12-21
          • 2021-12-23
          • 1970-01-01
          相关资源
          最近更新 更多