安装Docker

作者: Danielme | 来源:发表于2019-06-26 15:47 被阅读0次

Centos 7 安装 Docker

  1. 安装 yum 仓库配置工具和 Docker 存储依赖
    yum install -y yum-utils \
      device-mapper-persistent-data \
      lvm2
    
  2. 安装 Docker yum 仓库
    yum-config-manager \
      --add-repo \
      https://download.docker.com/linux/centos/docker-ce.repo
    
  3. 安装 Docker
    yum install -y docker-ce docker-ce-cli containerd.io
    
  4. 注册 Docker 服务,开机自动启动
    systemctl enable docker
    systemctl restart docker
    
  5. 配置 Docker , registry-mirrors 指定使用国内镜像仓库
    mkdir -p /etc/docker
    cat <<EOF > /etc/docker/daemon.json
    {
      "exec-opts": ["native.cgroupdriver=systemd"],
      "log-driver": "json-file",
      "log-opts": {
        "max-size": "100m"
      },
      "storage-driver": "overlay2",
      "storage-opts": [
        "overlay2.override_kernel_check=true"
      ],
      "registry-mirrors" : [
        "https://registry.docker-cn.com"
      ]
    }
    EOF
    
    systemctl daemon-reload
    systemctl restart docker
    
  6. 测试 Docker 是否安装成功
    docker run hello-world
    

相关文章

网友评论

    本文标题:安装Docker

    本文链接:https://www.haomeiwen.com/subject/oxjccctx.html