Home / Alt manpages / docker-search(1)

  • docker-search(1)
  • User command
  • linux

Search Docker Hub Precisely with docker search

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.

  • What you need: the Docker CLI, network access to Docker Hub, and a shell.
  • What it will not touch: local images, containers or the engine daemon. Searching is read-only and does not pull anything. Some installs still need access to local configuration or a proxy, but do not add sudo unless your Docker setup specifically requires it.

1. Confirm the installed command

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.

2. Run a broad search, then cut the noise

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.

3. Filter by popularity or official status

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
  • Filters narrow the search response only. They do not authenticate the publisher or scan the image.
  • Star counts are a discovery signal, not a security assessment. Check the Hub page, digest and provenance before you commit to a candidate.
  • Do not build new automation on is-automated. Docker's own documentation marks that filter deprecated; test existing scripts against the installed CLI and replace it where you can.

4. Show complete descriptions when context matters

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.

5. Produce a compact, reviewable result

--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.

6. Diagnose failures without changing state

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
  • Network or service error: check the term spelling, DNS, proxy and Docker Hub availability.
  • Access error: check the client configuration and your account or organisation policy.
  • Formatted command fails: drop --format and rerun a plain limited search to separate a template mistake from a connectivity problem.
  • Filtered query returns nothing: remove one filter at a time and check its value rather than grabbing an unfiltered result blind.

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.

Done means

  • Confirmed the installed Docker CLI version and the one-term command shape.
  • Searched Docker Hub without pulling images or touching local Docker state.
  • Combined stars and is-official filters and capped results with --limit.
  • Know that is-automated is deprecated and should not anchor new automation.
  • Chose --no-trunc for inspection and --format for explicit fields.
  • Treat search results as discovery data, then verify the chosen image before use.