docker search命令提示i/o timeout的解决方案
标签搜索

docker search命令提示i/o timeout的解决方案

mrui
2025-03-06 / 0 评论 / 65 阅读 / 正在检测是否收录...

配置好docker的镜像加速器后,会发现一个奇怪的现象。如果使用docker search命令搜索某个容器,会得到i/o timeout 的错误信息,但是用docker pull命令下载镜像时,却可以下载。

示例

[root@10-60-14-211 lnmp]# docker search nginx
Error response from daemon: Get "https://index.docker.io/v1/search?q=nginx&n=25": dial tcp 69.30.25.21:443: i/o timeout
[root@10-60-14-211 ~]# docker pull nginx:1.27.4-perl
1.27.4-perl: Pulling from library/nginx
7cf63256a31a: Already exists
bf9acace214a: Pull complete
513c3649bb14: Pull complete
d014f92d532d: Pull complete
9dd21ad5a4a6: Pull complete
943ea0f0c2e4: Pull complete
103f50cb3e9f: Pull complete
d8dfdc7acfb3: Pull complete
Digest: sha256:74edc8744a1080ccd9f9719e51e7d885b65dedaf2164a246f1cbd328f20f5d2e
Status: Downloaded newer image for nginx:1.27.4-perl
docker.io/library/nginx:1.27.4-perl

原因解读

docker search:直接查询Docker Hub API (https://index.docker.io/v1),而不是通过配置的镜像源。
docker pull:优先使用配置的镜像源,如果镜像源失败,尝试从Docker Hub拉取。
这种差异的原因在于Docker的设计理念:搜索功能主要面向Docker Hub官方仓库,而镜像源主要用于拉取(docker pull)操作。

解决方案

在搜索镜像时加上镜像加速器的地址。

[root@10-60-14-211 lnmp]# docker search 1ms.run/nginx
NAME                                     DESCRIPTION                                     STARS     OFFICIAL
nginx                                    Official build of Nginx.                        20633     [OK]
nginx/nginx-prometheus-exporter          NGINX Prometheus Exporter for NGINX and NGIN…   47
nginx/nginx-ingress                      NGINX and  NGINX Plus Ingress Controllers fo…   100
nginx/unit                               This repository is retired, use the Docker o…   65
nginx/nginx-ingress-operator             NGINX Ingress Operator for NGINX and NGINX P…   2
nginx/nginx-quic-qns                     NGINX QUIC interop                              1
nginx/unit-preview                       Unit preview features                           0
nginx/nginxaas-loadbalancer-kubernetes                                                   0
bitnami/nginx                            Bitnami container image for NGINX               196
ubuntu/nginx                             Nginx, a high-performance reverse proxy & we…   127
bitnamicharts/nginx                      Bitnami Helm chart for NGINX Open Source        0
rancher/nginx                                                                            2
kasmweb/nginx                            An Nginx image based off nginx:alpine and in…   8
linuxserver/nginx                        An Nginx container, brought to you by LinuxS…   224
redash/nginx                             Pre-configured nginx to proxy linked contain…   3
dtagdevsec/nginx                         T-Pot Nginx                                     0
paketobuildpacks/nginx                                                                   0
vmware/nginx                                                                             2
chainguard/nginx                         Build, ship and run secure software with Cha…   4
gluufederation/nginx                      A customized NGINX image containing a consu…   1
droidwiki/nginx                                                                          0
intel/nginx                                                                              0
circleci/nginx                           This image is for internal use                  2
corpusops/nginx                          https://github.com/corpusops/docker-images/     1
antrea/nginx                             Nginx server used for Antrea e2e testing        0
0

评论 (0)

取消