在CentOS 6.6上安装Docker [英] Installing Docker on CentOS 6.6

查看:103
本文介绍了在CentOS 6.6上安装Docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在CentOS 6.6 64位版本上安装Docker。当执行

I'm trying to install Docker on CentOS 6.6 64 bit version. When execute

sudo yum install docker

我明白了

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
  * base: mirrors.psychz.net
  * extras: centos-distro.cavecreek.net
  * updates: distro.ibiblio.org
No package docker available.
Error: Nothing to do


推荐答案

[澄清]

关于Centos操作系统要求,符合官方docker文档

Regarding Centos OS requirements as per the official docker docs:

要安装Docker Engine-社区,您需要
CentOS 7 的维护版本。
归档版本不受支持或测试。 (因此,我假设现在不再支持 Centos 6 。)

To install Docker Engine - Community, you need a maintained version of CentOS 7. Archived versions aren’t supported or tested. (So I assume Centos 6 is now no longer supported.)

以下食谱适用于Centos 7和8

The following recipes are for Centos 7 and 8

Centos 7

# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"




  • 步骤1 :安装必需的软件包。

    • Step 1: Install required packages.
    • $ sudo yum -y update
      $ sudo yum install -y yum-utils \
        device-mapper-persistent-data \
        lvm2
      




      • 步骤2 :使用以下命令来建立稳​​定的存储库。

        • Step 2: Use the following command to set up the stable repository.
        • $ sudo yum-config-manager \
              --add-repo \
              https://download.docker.com/linux/centos/docker-ce.repo
          




          • 步骤3 :安装最新版本的Docker CE和容器化

            • Step 3: Install the latest version of Docker CE and containerd
            • $ sudo yum install docker-ce docker-ce-cli containerd.io
              

              如果此步骤有误,请包装:docker-ce-xxx.centos.x86_64(docker- ce-stable)要求:container-selinux> = 2.9

              您可以:

              $ sudo yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.74-1.el7.noarch.rpm
              

              请参阅问题 RHEL上的Docker CE-要求:container-s elinux> = 2.9


              • 步骤4 :启动Docker。

              • Step 4: Start Docker.
              $ sudo systemctl start docker
              




              • 步骤5 :通过运行hello-world映像来验证Docker CE是否已正确安装。

                • Step 5: Verify that Docker CE is installed correctly by running the hello-world image.
                • $ sudo docker run hello-world
                  

                  如果您想将Docker用作非root用户,则现在应考虑使用以下方式将用户添加到 docker组:

                  If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like:

                  $ sudo usermod -aG docker $USER
                  $ docker run hello-world
                  

                  应该就是这样。

                  如果您也想安装docker-compose,可以按照其官方文档

                  In case you would like to install docker-compose too, you can follow its official docs.

                  Centos 8:

                  $ cat /etc/centos-release
                  CentOS Linux release 8.0.1905 (Core)
                  
                  $ sudo yum -y update
                  $ sudo yum install docker
                  $ sudo docker run hello-world
                  

                  就是这样。

                  这篇关于在CentOS 6.6上安装Docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆