如何搭建一个私有的镜像仓库 mirror

Docker 的 Mirror 仅能加速 docker.io 的镜像,而不能加速私有仓库的镜像。

1. 为什么需要一个私有的镜像仓库 mirror

  • 公网限速
  • dockerhub 拉取限制频率
  • 减少拉取镜像时间

2. 创建一个 Registry 镜像加速服务

  • 生成一个配置文件
version: 0.1
log:
  fields:
    service: registry
storage:
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /var/lib/registry
http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3