简体   繁体   English

Docker 搜索找不到图像,但 docker pull 可以

[英]Docker search cannot find image but docker pull can

When searching the image php:7.3.15-apache in openshift and we found it, but the same image is not found when searching using the docker search command.在openshift中搜索图片php:7.3.15-apache时找到了,但是使用docker search命令搜索时没有找到相同的图片。

Why it is like that ?为什么会这样? Why docker pull can find the image but docker search can't find the image.为什么docker pull可以找到镜像,但是docker search却找不到镜像。

Example 例子

在此处输入图片说明

testuser@docker:~$ sudo docker search php:7.3.15-apache
NAME                DESCRIPTION         STARS               OFFICIAL            AUTOMATED
testuser@docker:~$ 

When using docker pull, it is downloadable :使用 docker pull 时,可以下载:

testuser@docker:~$ sudo docker pull php:7.3.15-apache
7.3.15-apache: Pulling from library/php
68ced04f60ab: Downloading [=========>                                         ]  5.008MB/27.09MB
68ced04f60ab: Pull complete 
1d2a5d8fa585: Pull complete 
5d59ec4ae241: Pull complete 
d42331ef4d44: Pull complete 
408b7b7ee112: Pull complete 
570cd47896d5: Pull complete 
2419413b2a16: Pull complete 
8c722e1dceb9: Pull complete 
34fb68439fc4: Pull complete 
e775bf0f756d: Pull complete 
b1949a1e9661: Pull complete 
6ed8bcec42ae: Pull complete 
f6247da7d55f: Pull complete 
a090bafe99ea: Pull complete 
Digest: sha256:ad53b6b5737c389d1bcea8acc2225985d5d90e6eb362911547e163f1924ec089
Status: Downloaded newer image for php:7.3.15-apache
docker.io/library/php:7.3.15-apache

As far as I understand docker hub have only those versions of php .据我了解docker hub只有那些版本的 php 。

sudo docker search php

NAME                       DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
php                        While designed for web development, the PHP …   5114                [OK]                
phpmyadmin/phpmyadmin      A web interface for MySQL and MariaDB.          967                                     [OK]
adminer                    Database management in a single PHP file.       362                 [OK]                
php-zendserver             Zend Server - the integrated PHP application…   180                 [OK]                
webdevops/php-nginx        Nginx with PHP-FPM                              150                                     [OK]
webdevops/php-apache-dev   PHP with Apache for Development (eg. with xd…   116                                     [OK]
webdevops/php-apache       Apache with PHP-FPM (based on webdevops/php)    100                                     [OK]
bitnami/php-fpm            Bitnami PHP-FPM Docker Image                    86                                      [OK]
phpunit/phpunit            PHPUnit is a programmer-oriented testing fra…   75                                      [OK]
nazarpc/phpmyadmin         phpMyAdmin as Docker container, based on off…   60                                      [OK]
circleci/php               CircleCI images for PHP                         28                                      
thecodingmachine/php       General-purpose ultra-configurable PHP images   28                                      [OK]
phpdockerio/php72-fpm      PHP 7.2 FPM base container for PHPDocker.io.    19                                      [OK]
bitnami/phpmyadmin         Bitnami Docker Image for phpMyAdmin             18                                      [OK]
phpdockerio/php7-fpm       PHP 7 FPM base container for PHPDocker.io.      14                                      [OK]
phpdockerio/php56-fpm      PHP 5.6 FPM base container for PHPDocker.io     13                                      [OK]
graze/php-alpine           Smallish php7 alpine image with some common …   13                                      [OK]
appsvc/php                 Azure App Service php dockerfiles               12                                      [OK]
phpdockerio/php73-fpm      PHP 7.3 FPM base container for PHPDocker.io.    11                                      
phpdockerio/php71-fpm      PHP 7.1 FPM base container for PHPDocker.io.    7                                       [OK]
phpdockerio/php72-cli      PHP 7.2 CLI base container for PHPDocker.io.    4                                       [OK]
phpdockerio/php7-cli       PHP 7 CLI base container image for PHPDocker…   1                                       [OK]
phpdockerio/php56-cli      PHP 5.6 CLI base container for PHPDocker.io …   1                                       [OK]
phpdockerio/php71-cli      PHP 7.1 CLI base container for PHPDocker.io.    1                                       [OK]
isotopab/php               Docker PHP                                      0                                       [OK]

So you could either use 1 of that.所以你可以使用其中的 1 个。


OR, if you want this specific version或者,如果你想要这个特定版本


There is the specific image version on docker hub. docker hub 上具体的镜像版本。


You can use docker pull您可以使用docker pull

docker pull php:7.3.15-apache

And push it to your private registry with docker push并使用docker push将其推送到您的私有注册表

docker push

More about it.更多关于它。


And use your own registry instead of docker hub.并使用您自己的注册表而不是 docker hub。

To deploy an image from a private repository, you must create an image pull secret with your image registry credentials.要从私有存储库部署映像,您必须使用映像注册表凭据创建映像拉取密钥。 You have more informations under your Image Name.您的图像名称下有更多信息。


I hope this answer your question.我希望这能回答你的问题。 Let me know if you have any more questions.如果您还有其他问题,请告诉我。

@jt97 Thanks for directing me to the correct direction.I am adding more details with screenshots in this answer for newbies like me on how to search in dockerhub. @jt97 感谢您将我引导到正确的方向。我正在为像我这样的新手在此答案中添加更多带有屏幕截图的详细信息,了解如何在 dockerhub 中进行搜索。

  1. Go to docker hub and search php转到 docker hub 并搜索 php 在此处输入图片说明
  2. Select the first result.选择第一个结果。 Select 'Tags' tab and enter the version name in the 'Filter Tags'.选择“标签”选项卡并在“过滤标签”中输入版本名称。 I have given 7.3.15-apache.我已经给出了 7.3.15-apache。 No need to mention php again here.这里不用再提php了。 在此处输入图片说明

I don't know why docker search can't find this image.我不知道为什么 docker search 找不到这个图像。 May be as @jt97 mentioned, it display only major versions.可能正如@jt97 提到的,它只显示主要版本。

From an answer in How to search images from private 1.0 registry in docker?来自如何从 docker 中的私有 1.0 注册表中搜索图像?

You can specify the repository as part of the search.您可以将存储库指定为搜索的一部分。

I'm on RHEL 7.7 and if I do a "docker search centos8", it comes back with nothing but "docker search docker.io/centos8" works fine.我在 RHEL 7.7 上,如果我执行“docker search centos8”,它会返回,但“docker search docker.io/centos8”工作正常。

It looks like "docker pull" goes for docker hub by default, so the result is consistent for all docker users.看起来“docker pull”默认用于docker hub,因此结果对于所有docker用户都是一致的。 [https://github.com/moby/moby/issues/7203] [https://github.com/moby/moby/issues/7203]

The search command is less consistent (and doesn't have the same strict requirement for the level of consistency as 'pull').搜索命令的一致性较低(并且对一致性级别的要求与“拉”不同)。 If the docker daemon is running with multiple " --add-registry" options, the search doesn't appear to use them all.如果 docker 守护进程使用多个“--add-registry”选项运行,则搜索似乎不会全部使用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM