关于docker:阿里云镜像使用阿里云Docker-CE-镜像安装Docker

46次阅读

共计 4749 个字符,预计需要花费 12 分钟才能阅读完成。

一、参考链接

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

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]#

正文完
 0