Skip to content

Docker代理

前提: 准备一个域名并做好 DNS 解析到准备好的服务器的 IP

方案一

https://github.com/dqzboy/Docker-Proxy

# 国外环境
bash -c "$(curl -fsSL https://raw.githubusercontent.com/dqzboy/Docker-Proxy/main/install/DockerProxy_Install.sh)"
# 国内环境cdn加速地址
bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/dqzboy/Docker-Proxy/install/DockerProxy_Install.sh)"

方案二 推荐

https://github.com/kubesre/docker-registry-mirrors/blob/main/dockerproxy/README.md

vi docker-proxy.yaml
services:
crproxy:
image: ghcr.io/daocloud/crproxy/crproxy:v0.12.4
container_name: crproxy
restart: unless-stopped
ports:
- 80:8080
- 443:8080
command: |
--acme-cache-dir=/tmp/acme
--acme-hosts=*
--default-registry=docker.io
tmpfs:
- /tmp/acme
docker compose -f docker-proxy.yaml up -d

使用

vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.gaojinbo.com"]
}
systemctl restart docker
docker pull busybox
docker pull alpine:3.9
docker pull docker.gaojinbo.com/library/alpine:3.7