crproxy - Docker镜像加速器 docker


https://hub.docker.com/r/cleverest/crproxy

https://github.com/DaoCloud/crproxy

https://github.com/cmliu/CF-Workers-docker.io


docker pull dockerproxy.cn/cleverest/crproxy

docker pull dockerpull.com/cleverest/crproxy


vim  /etc/docker/daemon.json

{"registry-mirrors": ["https://registry.docker-cn.com, http://hub-mirror.c.163.com, https://docker.mirrors.ustc.edu.cn, https://dockerpull.com, https://dockerproxy.cn"]}


1.P代理

docker run -d --name crproxy   --hostname crproxy   -p 9991:443  --restart always   --restart=always --network mgr  --ip 172.18.0.191  -v /etc/localtime:/etc/localtime:ro  cleverest/crproxy


2.配置加速器

cat > /etc/docker/daemon.json <<EOF
{
  "registry-mirrors": ["https://192.168.3.33:9991"],
  "insecure-registries": ["192.168.3.33:9991"],
  "exec-opts": ["native.cgroupdriver=systemd"]
}
EOF

# 重启Docker服务

systemctl daemon-reload && systemctl restart docker


3.拉取测试


-若配置了加速器地址,并且镜像源于 Docker Hub 时,可以无需加上域名前缀,其他镜像源站必须加上前缀

docker pull alpine:3.18

docker pull adguard/adguardhome

# 当然也是可以加上前缀,如:

docker pull 192.168.3.33:9991/docker.io/alpine:3.18

docker pull 192.168.3.33:9991/docker.io/adguard/adguardhome


-拉取非 Docker Hub 平台镜像时, 必须加域名前缀,各个知名镜像站拉取测试

# Google

docker pull 192.168.3.33:9991/gcr.io/kaniko-project/executor:debug

# GitHub

docker pull 192.168.3.33:9991/ghcr.io/openfaas/queue-worker

# Kubernetes

docker pull 192.168.3.33:9991/k8s.gcr.io/etcd:3.5.7-0

# 新Kubernetes

docker pull 192.168.3.33:9991/registry.k8s.io/kube-apiserver:v1.30.0

# Red Hat

docker pull 192.168.3.33:9991/quay.io/calico/cni

# Microsoft

docker pull 192.168.3.33:9991/mcr.microsoft.com/powershell

# Elastic 

docker pull 192.168.3.33:9991/docker.elastic.co/elasticsearch/elasticsearch:8.1.0

# NVIDIA

docker pull 192.168.3.33:9991/nvcr.io/nvidia/cuda:12.1.0-runtime-ubuntu20.04


# nginx

server {
    listen 80;
    server_name www.example.com;
    # Redirect HTTP to HTTPS
    return 301 https://$host$request_uri;
}
server {
    listen 443 ssl;
    server_name www.example.com;
    ssl_certificate /你的证书路径/cert.pem;
    ssl_certificate_key /你的证书路径/privkey.pem;
    location / {
        proxy_pass https://192.168.3.33:9991;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}


签名:这个人很懒,什么也没有留下!
最新回复 (0)
返回