3

【阿里云镜像】使用阿里云Docker CE 镜像安装Docker

 2 years ago
source link: https://segmentfault.com/a/1190000041081186
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

一、参考链接

阿里巴巴开源镜像站:阿里巴巴开源镜像站

Docker CE 镜像:Docker CE 镜像

二、Docker CE简介

Docker CE 是免费的 Docker 产品的新名称,Docker CE 包含了完整的 Docker 平台,非常适合开发人员和运维团队构建容器 APP。

下载链接:https://mirrors.aliyun.com/docker-ce/

三、使用阿里云Docker CE镜像安装Docker

1、SSH连接CentOS 7系统

在这里插入图片描述

2、基于CentOS 7安装配置Docker(使用 yum 进行安装)

# step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
# Step 4: 更新并安装Docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce
# Step 4: 开启Docker服务
sudo service docker start

# 注意:
# 官方软件源默认启用了最新的软件,您可以通过编辑软件源的方式获取各个版本的软件包。例如官方并没有将测试版本的软件源置为可用,您可以通过以下方式开启。同理可以开启各种测试版本等。
# vim /etc/yum.repos.d/docker-ce.repo
#   将[docker-ce-test]下方的enabled=0修改为enabled=1
#
# 安装指定版本的Docker-CE:
# Step 1: 查找Docker-CE的版本:
# yum list docker-ce.x86_64 --showduplicates | sort -r
#   Loading mirror speeds from cached hostfile
#   Loaded plugins: branch, fastestmirror, langpacks
#   docker-ce.x86_64            17.03.1.ce-1.el7.centos            docker-ce-stable
#   docker-ce.x86_64            17.03.1.ce-1.el7.centos            @docker-ce-stable
#   docker-ce.x86_64            17.03.0.ce-1.el7.centos            docker-ce-stable
#   Available Packages
# Step2: 安装指定版本的Docker-CE: (VERSION例如上面的17.03.0.ce.1-1.el7.centos)
# sudo yum -y install docker-ce-[VERSION]
  • 1、安装必要的一些系统工具

    yum install -y yum-utils device-mapper-persistent-data lvm2

    在这里插入图片描述

  • 2、添加软件源信息

    yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

    在这里插入图片描述

    [root@centos yum.repos.d]# cat docker-ce.repo
    [docker-ce-stable]
    name=Docker CE Stable - $basearch
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
    enabled=1
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
    
    [docker-ce-stable-debuginfo]
    name=Docker CE Stable - Debuginfo $basearch
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/stable
    enabled=0
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
    
    [docker-ce-stable-source]
    name=Docker CE Stable - Sources
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/stable
    enabled=0
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
    
    [docker-ce-test]
    name=Docker CE Test - $basearch
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/test
    enabled=0
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
    
    [docker-ce-test-debuginfo]
    name=Docker CE Test - Debuginfo $basearch
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/test
    enabled=0
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
    
    [docker-ce-test-source]
    name=Docker CE Test - Sources
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/test
    enabled=0
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
    
    [docker-ce-nightly]
    name=Docker CE Nightly - $basearch
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/nightly
    enabled=0
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
    
    [docker-ce-nightly-debuginfo]
    name=Docker CE Nightly - Debuginfo $basearch
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/nightly
    enabled=0
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
    
    [docker-ce-nightly-source]
    name=Docker CE Nightly - Sources
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/nightly
    enabled=0
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
  • 3、配置Docker -ce.repo镜像

    sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
  • 4、更新并安装Docker-CE

    sudo yum makecache fast
    sudo yum -y install docker-ce
[root@centos yum.repos.d]# yum makecache fast
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                               | 3.6 kB  00:00:00
docker-ce-stable                                                                                   | 3.5 kB  00:00:00
extras                                                                                             | 2.9 kB  00:00:00
updates                                                                                            | 2.9 kB  00:00:00
(1/2): docker-ce-stable/7/x86_64/updateinfo                                                        |   55 B  00:00:00
(2/2): docker-ce-stable/7/x86_64/primary_db                                                        |  69 kB  00:00:00
Metadata Cache Created
[root@centos yum.repos.d]#

在这里插入图片描述

  • 5、开启Docker服务

    [root@centos yum.repos.d]# systemctl start docker
    [root@centos yum.repos.d]# systemctl status docker

    在这里插入图片描述

    3、检查Docker是否安装成功

    [root@centos yum.repos.d]# docker version
    Client: Docker Engine - Community
     Version:           20.10.11
     API version:       1.41
     Go version:        go1.16.9
     Git commit:        dea9396
     Built:             Thu Nov 18 00:38:53 2021
     OS/Arch:           linux/amd64
     Context:           default
     Experimental:      true
    
    Server: Docker Engine - Community
     Engine:
    Version:          20.10.11
    API version:      1.41 (minimum version 1.12)
    Go version:       go1.16.9
    Git commit:       847da18
    Built:            Thu Nov 18 00:37:17 2021
    OS/Arch:          linux/amd64
    Experimental:     false
     containerd:
    Version:          1.4.12
    GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
     runc:
    Version:          1.0.2
    GitCommit:        v1.0.2-0-g52b36a2
     docker-init:
    Version:          0.19.0
    GitCommit:        de40ad0
    [root@centos yum.repos.d]#

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK