Skip to content

[Docker] 国内镜像源

最新的

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-EOF
{
    "registry-mirrors": [
        "https://dockerproxy.com",
        "https://docker.1ms.run",
        "https://docker.m.daocloud.io",
        "https://dockerhub.icu",
        "https://docker.chenby.cn"
    ]
}
EOF

cat /etc/docker/daemon.json

sudo systemctl daemon-reload
sudo systemctl restart docker

最管用的,实在不行,可以试试vi模式,粘贴

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-EOF
{
    "registry-mirrors": [
        "https://dockerproxy.com",
        "https://mirror.baidubce.com",
        "https://docker.m.daocloud.io",
        "https://docker.nju.edu.cn",
        "https://docker.mirrors.sjtug.sjtu.edu.cn"
    ]
}
EOF

cat /etc/docker/daemon.json

sudo systemctl daemon-reload
sudo systemctl restart docker

配置代理

mkdir -p /etc/systemd/system/docker.service.d
vi /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]
Environment="HTTP_PROXY=http://10.0.35.90:7890"
Environment="HTTPS_PROXY=http://10.0.35.90:7890"
Environment="NO_PROXY=localhost,127.0.0.1"
{
 "proxies": {
   "default": {
     "httpProxy": "http://10.0.35.90:7890",
     "httpsProxy": "http://10.0.35.90:7890",
     "noProxy": "localhost,127.0.0.0/8"
   }
 }
}

sudo tee /etc/docker/daemon.json <<-EOF
{
  "registry-mirrors": [
      "https://docker.nju.edu.cn",
      "https://docker.mirrors.sjtug.sjtu.edu.cn",
      "https://registry.docker-cn.com",       
      "https://docker.mirrors.ustc.edu.cn",     
      "https://hub-mirror.c.163.com",        
      "https://mirror.baidubce.com",         
      "https://ccr.ccs.tencentyun.com"
  ],
  "proxies": {
    "http-proxy": "http://10.0.35.90:7890",
    "https-proxy": "http://10.0.35.90:7890",
    "no-proxy": "localhost"
  }
}
EOF

sudo systemctl daemon-reload
sudo systemctl restart docker

sudo tee /etc/docker/daemon.json <<-EOF
{
  "proxies": {
     "default": {
       "httpProxy": "http://10.0.35.90:7890",
       "httpsProxy": "http://10.0.35.90:7890",
       "noProxy": "localhost,127.0.0.1,127.0.0.0/8"
     }
 }
}
EOF

sudo systemctl daemon-reload
sudo systemctl restart docker

202406

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-EOF
{
    "registry-mirrors": [
        "https://docker.nju.edu.cn",
        "https://docker.mirrors.sjtug.sjtu.edu.cn",
        "https://registry.docker-cn.com",       
        "https://docker.mirrors.ustc.edu.cn",     
        "https://hub-mirror.c.163.com",        
        "https://mirror.baidubce.com",         
        "https://ccr.ccs.tencentyun.com"
    ]
}
EOF

cat /etc/docker/daemon.json

sudo systemctl daemon-reload
sudo systemctl restart docker

vi /etc/docker/daemon.json

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

中科大

https://docker.mirrors.ustc.edu.cn/

docker官方中国

https://registry.docker-cn.com

阿里云

登录阿里云去 控制台->容器镜像服务 -> 镜像加速器  查看地址

重启docker

powershell
sudo systemctl daemon-reload
sudo systemctl restart docker

# 查看
docker info