3

搭建dockerhub镜像加速仓库

 1 year ago
source link: https://www.bboy.app/2022/10/12/%E6%90%AD%E5%BB%BAdockerhub%E9%95%9C%E5%83%8F%E5%8A%A0%E9%80%9F%E4%BB%93%E5%BA%93/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

搭建dockerhub镜像加速仓库

2022-10-12 17:27:00 linux

20221012-1.webp

因为某些原因国外的

  • registry.k8s.io
  • quay.io
  • k8s.gcr.io
  • ghcr.io
  • gcr.io
  • dockerhub

这些镜像仓库在国内的访问体验不是很好,因为自己国外有几台服务器,索性搭建一个镜像代理服务

其实很简单,我的想法就是cloudflare代理到服务器里面的nginx,然后nginx代理到registry容器就这样

docker-compose.yaml

version: "3"
services:
  dockerhub:
    image: "registry:2.8.1"
    container_name: "dockerhub"
    restart: "always"
    volumes:
      - "/etc/localtime:/etc/localtime"
      - "./data:/var/lib/registry"
      - "./config.yml:/etc/docker/registry/config.yml"
    ports:
      - "5000:5000"

config.yml

version: 0.1
storage:
  filesystem:
    rootdirectory: /var/lib/registry
  delete:
    enabled: true
  maintenance:
    uploadpurging:
      enabled: true
      age: 168h
      dryrun: false
      interval: 1m
http:
  addr: 0.0.0.0:5000
proxy:
  remoteurl: https://registry-1.docker.io

配置就是这么多配置,之后就可以直接pull镜像了

docker pull xxxxx.com/prom/prometheus

使用cloudflare作为cdn的话速度还是比较快的

欢迎关注我的博客 www.bboy.app

Have Fun



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK