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

Posted xuyebao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阿里云镜像使用阿里云Docker CE 镜像安装Docker相关的知识,希望对你有一定的参考价值。

@TOC

一、参考链接

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

Docker CE 镜像:Docker CE 镜像

二、Docker CE简介

下载链接: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镜像
```bash
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]#

以上是关于阿里云镜像使用阿里云Docker CE 镜像安装Docker的主要内容,如果未能解决你的问题,请参考以下文章

Centos7系统安装docker,并配置阿里云镜像加速器

docker使用阿里云镜像仓库

阿里云服务器中Docker安装与镜像使用MySQLredis快速访问

docker配置国内阿里云镜像源

docker配置国内阿里云镜像源

Docker——常用镜像的安装 & 本地镜像推送发布到阿里云