“DockerHub镜像加速和代理”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
(Evan移动页面Docker Hub镜像加速DockerHub镜像加速
第1行: 第1行:
 +
=2024=
 +
<pre>
 +
2024 要login hubdocker 可能得代理才行
 +
 +
# docker pull redis:7.4-alpine
 +
7.4-alpine: Pulling from library/redis
 +
c6a83fedfae6: Pulling fs layer
 +
9d56419430d6: Pulling fs layer
 +
9d36ad935203: Pulling fs layer
 +
0085610e8e12: Waiting
 +
6c8161c30f9c: Waiting
 +
ba03bb8a47bb: Waiting
 +
4f4fb700ef54: Waiting
 +
5d7c7efa14ca: Waiting
 +
error pulling image configuration: Get "https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/da/da7b3f96549f51221ac02ad16251b3d0df33bbc4490971b48348fc87eadc4a77/data?verify=1723966233-CNOT0xo1C1m2mDPPN2J1uvTx5ZU%3D": dial tcp 31.13.94.23:443: i/o timeout
 +
 +
 +
配置mirrors 改了dns 也是这样  代理 是最快的办法  可能不是最好的
 +
 +
cat  /etc/systemd/system/docker.service.d/http-proxy.conf
 +
[Service]
 +
Environment="HTTP_PROXY=http://localhost:8080"
 +
Environment="HTTPS_PROXY=http://localhost:8080"
 +
 +
docker pull redis:7.4-alpine
 +
7.4-alpine: Pulling from library/redis
 +
c6a83fedfae6: Pull complete
 +
9d56419430d6: Pull complete
 +
9d36ad935203: Pull complete
 +
0085610e8e12: Pull complete
 +
6c8161c30f9c: Pull complete
 +
ba03bb8a47bb: Pull complete
 +
4f4fb700ef54: Pull complete
 +
5d7c7efa14ca: Pull complete
 +
Digest: sha256:eaea8264f74a95ea9a0767c794da50788cbd9cf5223951674d491fa1b3f4f2d2
 +
Status: Downloaded newer image for redis:7.4-alpine
 +
 +
 +
 +
</pre>
 +
=old=
 
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。
 
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。
 
配置加速地址
 
配置加速地址
第40行: 第81行:
 
</pre>
 
</pre>
 
=see also=
 
=see also=
 +
 +
[https://xiaowangye.org/posts/china-docker-registry-proxy-guide/ 解决国内无法下载 Docker 镜像的问题]
 +
 +
 +
 +
 
[https://y0ngb1n.github.io/a/docker-registry-mirrors.html?js Docker Hub 镜像加速器]
 
[https://y0ngb1n.github.io/a/docker-registry-mirrors.html?js Docker Hub 镜像加速器]
 +
 +
  
 
  [[category:Container]]
 
  [[category:Container]]

2024年8月18日 (日) 07:23的版本

2024

2024 要login hubdocker 可能得代理才行 

# docker pull redis:7.4-alpine
7.4-alpine: Pulling from library/redis
c6a83fedfae6: Pulling fs layer 
9d56419430d6: Pulling fs layer 
9d36ad935203: Pulling fs layer 
0085610e8e12: Waiting 
6c8161c30f9c: Waiting 
ba03bb8a47bb: Waiting 
4f4fb700ef54: Waiting 
5d7c7efa14ca: Waiting 
error pulling image configuration: Get "https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/da/da7b3f96549f51221ac02ad16251b3d0df33bbc4490971b48348fc87eadc4a77/data?verify=1723966233-CNOT0xo1C1m2mDPPN2J1uvTx5ZU%3D": dial tcp 31.13.94.23:443: i/o timeout


配置mirrors 改了dns 也是这样  代理 是最快的办法  可能不是最好的 

cat  /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://localhost:8080"
Environment="HTTPS_PROXY=http://localhost:8080"

docker pull redis:7.4-alpine
7.4-alpine: Pulling from library/redis
c6a83fedfae6: Pull complete 
9d56419430d6: Pull complete 
9d36ad935203: Pull complete 
0085610e8e12: Pull complete 
6c8161c30f9c: Pull complete 
ba03bb8a47bb: Pull complete 
4f4fb700ef54: Pull complete 
5d7c7efa14ca: Pull complete 
Digest: sha256:eaea8264f74a95ea9a0767c794da50788cbd9cf5223951674d491fa1b3f4f2d2
Status: Downloaded newer image for redis:7.4-alpine



old

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。 配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+


sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
    "registry-mirrors": [
        "https://1nj0zren.mirror.aliyuncs.com",
        "https://docker.mirrors.ustc.edu.cn",
        "http://f1361db2.m.daocloud.io",
        "https://registry.docker-cn.com"
    ]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

查看

docker info


Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://1nj0zren.mirror.aliyuncs.com/
  https://docker.mirrors.ustc.edu.cn/
  http://f1361db2.m.daocloud.io/
  https://registry.docker-cn.com/
 Live Restore Enabled: false

WARNING: No swap limit support

see also

解决国内无法下载 Docker 镜像的问题



Docker Hub 镜像加速器