注意其中的代理地址 HTTPS_PROXY

version: '3.1'
<!--more-->
services:
  registry:
    image: registry:2.8.2
    #network_mode: "host"
    environment:
      REGISTRY_HTTP_ADDR: "0.0.0.0:5000"
      REGISTRY_PROXY_REMOTEURL: "https://registry-1.docker.io"
      REGISTRY_PROXY_TTL: 168h 
      HTTPS_PROXY: "http://192.168.25.18:7890"
    restart: always
    container_name: registry
    ports:
      - 5000:5000
    volumes:
      - "./registry:/var/lib/registry"
docker-compose -f registry.yml up -d

sudo vim /etc/docker/daemon.json

{
  ...
  "insecure-registries": ["192.168.1.30:5000"],
    "registry-mirrors": [
    "http://192.168.1.30:5000"
  ]
  ...
}

References

最后修改:2024 年 09 月 05 日
如果觉得我的文章对你有用,请随意赞赏