docker更换国内镜像源加速拉取镜像

编辑文件

vi /etc/docker/daemon.json   

没有该文件则自己创建,添加如下内容

{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}

如果有此文件且已有内容,在{}中添加一行,注意这是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": ["http://hub-mirror.c.163.com"]
}

重启服务

systemctl restart docker.service

可以多配几个国内镜像源

  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/","http://hub-mirror.c.163.com","http://f1361db2.m.daocloud.io"]
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。