Docker search returns status code 500

I use the docker.io package on my WSL2 Ubuntu 20.04 distro.

I am not using the Docker Desktop front-end, I’m using the command line in my Windows Terminal to execute all my docker actions…

Everything works (pull, push, run, save, load, …).

The docker search has always been reliable as well (using the public repository).

But I’m writing a small tutorial, and to my surprise, the search for the hello-world example fails with the generic server error (exit code 500):

$ docker search --filter is-official=true --no-trunc world
Error response from daemon: Unexpected status code 500
$ docker search --filter is-official=true --no-trunc hello
Error response from daemon: Unexpected status code 500
$ docker search --filter is-official=true --no-trunc world
Error response from daemon: Unexpected status code 500

The weird thing is that one extra character gets things working again:

$ docker search --filter is-official=true --no-trunc 'hello-'
NAME            DESCRIPTION                                          STARS     OFFICIAL   AUTOMATED
hello-world     Hello World! (an example of minimal Dockerization)   1722      [OK]
hello-seattle   Hello from DockerCon 2016 (Seattle)!                 10        [OK]

At first, I thought it might be a problem with the number of matches, which is why I have the filter options. The search without filters on https://hub.docker.com works just fine, though!

I have been able to reproduce the problem with docker servers on SLES12-based Linux platforms as well…

Is it a bug or feature?

Wow… that is interesting

It is kind and optimistic of you that you think it could be a bug :slight_smile: I honestly don’t use docker search for a long time and I remember similar issues with that command reported on the forum when logging out made docker search working again. I thought it could be an issue with authentication and hour private images not being searchable, but in this case, it doesn’t matter if I log in or not. I tried your command with “hello-” but I also tried “hel” which also worked. So my guess is that depending on the keyword something in the search result breakes the HTTP response. For example an invalid character in the description of one of the containers or something happens even before generaring the search result so the result response is incomplete.

I tried docker search hello --limit 1. It worked too, so I was pretty sure it was a bug depending on the actual search result. Since you mentioned it works on Dcoker hub, I searched for “hello” there and tried and increased my limit in the terminal from 1 to 12 without issues. 13 didn’t work (lucky number, isn’t it?), so I checked which is the 13th result on Docker hub. It was: https://hub.docker.com/_/microsoft-mcr-hello-world

The only strange thing I can see is the name of the image in the search result, which is “Mcr Hello World” containing spaces, but when I search for “OpenCRAVAT” it is not a problem. I also tested if the parenthesis in the description is causing this, so I edited the description of my test image, but that worked well too. At this point we can open an issue here:

I think I will do that and come back with the link where you can join the conversation.

EDIT:

Here is the issue I opened:

This issue has been fixed :slight_smile: I like when bugfixes as fast as this was. Of course, the bugreport with our detailed descripon was necessary. Thanks @flandraco for reporting it.

1 Like