Centos下安装Docker,并配置国内docker源

Centos下安装Docker

  • 将centos的yum源替换为国内的yum源(可选):
    • mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
      
      curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
      
      yum makecache
  • 安装所需要的软件包:

    • yum install -y yum-utils \
      device-mapper-persistent-data \
      lvm2
  • 安装containerd.io(CentOs7可以忽略),因为centos8默认使用podman代替docker,所以需要containerd.io,那我们就安装一下就好了

    • yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
  • 安装docker

    • yum install docker-ce docker-ce-cli containerd.io
  • 配置国内的docker源:

    •   
      mkdir -p /etc/docker
      tee /etc/docker/daemon.json <<EOF
      {
      "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
      "registry-mirrors": ["https://mirror.ccs.tencentyun.com"],
      "registry-mirrors": ["https://registry.docker-cn.com"],
      "registry-mirrors": ["http://hub-mirror.c.163.com"]
      }
      EOF
  • 启动服务:
    •   
      systemctl start docker.service # 启动服务
      # 或者
      systemctl enable docker.service #设置为开机启动
上一篇:Centos 下面安装 docker


下一篇:Python yield 使用浅析(iterable generator )