0%

K8s 集群搭建系列(二) Docker 安装

引言

承接上一章【K8s 集群搭建系列(一) Centos 7 准备】,我们进行下一步,安装 Docker。好了,让我们开始吧!

Docker 安装

  • 必要工具安装
    1
    [root@localhost ~]# yum install -y yum-utils
  • 添加 Docker 源
    1
    [root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  • 安装 Docker
    1
    2
    [root@localhost ~]# yum makecache fast
    [root@localhost ~]# yum install -y docker-ce-19.03.12
  • 开机自启
    1
    2
    [root@localhost ~]# systemctl enable docker 
    [root@localhost ~]# systemctl start docker
  • 配置镜像源
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    [root@localhost ~]# vim /etc/docker/daemon.json

    # 添加以下内容
    {
    "registry-mirrors": [
    "https://registry.docker-cn.com"
    ]
    }

    # 重启 Docker
    [root@localhost ~]# systemctl daemon-reload
    [root@localhost ~]# systemctl restart docker

尾声

Docker 已经安装完毕了,我们可以迅速进入下一章【K8s 搭建】