docker search looks trivial until one term returns forty near-identical images and no clue which one to trust. This gets you a repeatable way to narrow that list, see full descriptions, and pull out just the fields you need. Ten minutes, Docker CLI 29.8.1, and it only ever talks to Docker Hub: it is not a general search interface for a private registry.
sudo unless your Docker setup specifically requires it.Check the binary and its local option syntax before trusting a copied example:
$ command -v docker
/usr/bin/docker
$ docker --version
Docker version 29.8.1, build 4a63305
$ docker search --help
Usage: docker search [OPTIONS] TERM
Search Docker Hub for images
One required search term, one table back: image name, description, star count, official-image marker. Docker Hub data changes constantly, so treat names, descriptions and counts as a snapshot, not a permanent inventory.
Checkpoint: if docker --version fails, fix the CLI install or your PATH. A daemon is not the missing piece here; this query never needs one.
Start with a familiar term to see the default table:
$ docker search busybox
NAME DESCRIPTION STARS OFFICIAL
busybox Busybox base image. 3517 [OK]
Your rows and counts will vary. A term can match more than one repository, and descriptions get truncated by default. Add --limit when you are exploring or building a small review set:
$ docker search --limit=3 busybox
NAME DESCRIPTION STARS OFFICIAL
busybox Busybox base image. 3517 [OK]
cleanstart/busybox ...
activestate/busybox ...
The limit is a ceiling, not a promise: the service can return fewer results than you asked for. It bounds the display; it does not rank images by whether they are fit for production.
Filters use key=value. The installed manual documents stars, is-official, and the deprecated is-automated. For a first shortlist, require at least three stars:
$ docker search --filter=stars=3 --limit=3 busybox
NAME DESCRIPTION STARS OFFICIAL
busybox Busybox base image. 3517 [OK]
Repeat the flag to combine filters. This asks for official images at the same star threshold:
$ docker search \
--filter=is-official=true \
--filter=stars=3 \
--limit=5 \
nginx
Long descriptions get shortened in the normal table. Add --no-trunc when you need the whole thing:
$ docker search --filter=stars=3 --limit=1 --no-trunc busybox
NAME DESCRIPTION STARS OFFICIAL
busybox Busybox base image. ... 3517 [OK]
Column spacing and wording are service data, not a fixed format, so do not parse the aligned table by splitting on spaces. A description can contain spaces of its own and can change without any change to the command. Use formatted output instead, next.
--format takes a Go template. The documented fields are .Name, .Description, .StarCount, and .IsOfficial. This example drops headers and separates the fields with colons:
$ docker search --limit=3 \
--format '{{.Name}}:{{.StarCount}}:{{.IsOfficial}}' \
busybox
busybox:3517:[OK]
cleanstart/busybox:0:
activestate/busybox:0:
An empty .IsOfficial field means the result was not marked official in this response, not that it is literally false. Need headings for a person to read? Use the table directive:
$ docker search --limit=3 \
--format 'table {{.Name}}\t{{.StarCount}}\t{{.IsOfficial}}' \
busybox
NAME STARS OFFICIAL
busybox 3517 [OK]
Tip: keep the template quoted so the shell leaves its braces alone. And do not mistake this for a signed image record: it is still a live search response, taken at face value.
A non-zero exit means the query did not complete. Capture it straight away:
docker search --limit=5 IMAGE_TERM
status=$?
if [ "$status" -ne 0 ]; then
printf 'docker search failed with status %s\n' "$status" >&2
exit "$status"
fi
--format and rerun a plain limited search to separate a template mistake from a connectivity problem.Logging in is not part of this guide and changes credential state, so do not run docker login just because an ordinary public search came back empty.
stars and is-official filters and capped results with --limit.is-automated is deprecated and should not anchor new automation.--no-trunc for inspection and --format for explicit fields.