Searching Docker Hub from the Command Line
How to query registries using docker search, filter results by stars and official status, format output with Go templates, and use OCI registry APIs.
Published on • November 18, 2026
AI Assistant

When working in headless terminal sessions, remote SSH environments, or automated scripting pipelines, opening a Web browser to search Docker Hub for container images can slow down your workflow. The Docker CLI includes a built-in search tool (docker search) that enables quick image discovery directly from your terminal.
In this tutorial, we will cover how to use docker search effectively, apply filters for security and community trust, format output for automation scripts, and interact directly with OCI registry search APIs.
The Essentials of docker search
The basic syntax for querying Docker Hub is:
docker search <query>
For example, searching for Redis images:
docker search redis
This returns a table containing matching public repositories:
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
redis Redis is an open source key-value store. 12840 [OK]
bitnami/redis Bitnami Redis Docker Image 620 [OK]
ubuntu/redis Redis packaged by Canonical 18
...
Table Columns Explained:
- NAME: The repository reference (
<user>/<repo>or root for official images). - DESCRIPTION: A brief summary provided by the repository owner.
- STARS: Community bookmark count reflecting popularity and usage.
- OFFICIAL: Indicates
[OK]if the image is a Docker Official Image. - AUTOMATED: Indicates
[OK]if the repository builds automatically from a linked VCS repository (legacy Docker Hub feature).
Filtering Search Results
Docker Hub contains thousands of community variants for popular tools. You can narrow down search results using the --filter (or -f) flag.
1. Filtering for Official Images Only
To exclude third-party or unverified images and list only Docker Official Images:
docker search --filter "is-official=true" postgres
2. Filtering by Minimum Popularity (Stars)
To filter out low-quality or inactive repositories, set a minimum star threshold:
docker search --filter "stars=50" python
3. Combining Multiple Filters
Filters can be combined to find highly rated, official, or automated repositories:
docker search --filter "is-official=true" --filter "stars=100" nginx
Limiting and Formatting Output
By default, docker search returns up to 25 results. You can adjust this limit and customize the output format for downstream shell pipelines.
Limiting Results Count
Use --limit to cap the number of returned repositories (max 100):
docker search --limit 5 node
Formatting Output with Go Templates
The --format flag allows you to format output as clean text, JSON, or custom table columns using Go template syntax.
# Display only repository names and star counts
docker search --format "table {{.Name}}\t{{.Stars}}\t{{.IsOfficial}}" alpine
# Output raw JSON lines for parsing with jq
docker search --format '{"name":"{{.Name}}","stars":{{.Stars}}}' redis | jq .
Programmatic Registry Search via API
While docker search queries Docker Hub by default, you can also query private OCI registries or Docker Hub programmatically using standard HTTP APIs.
Querying Docker Hub v2 API directly via curl:
curl -s "https://hub.docker.com/v2/search/repositories/?query=mariadb&page_size=5" | jq '.results[] | {name: .repo_name, stars: .star_count, description: .short_description}'
Summary & Command Reference
| Goal | Command Example |
|---|---|
| Basic Search | docker search nginx |
| Filter Official | docker search --filter "is-official=true" redis |
| Filter Stars (>=100) | docker search --filter "stars=100" mysql |
| Limit Results (Top 5) | docker search --limit 5 python |
| Custom Format | docker search --format "{{.Name}}: {{.Stars}} stars" node |
Using docker search with proper filters keeps your command-line workflow fast while ensuring you pull trusted, official container base images.