Docker search command

Docker command reference


docker searchThe command is used to search for images in Docker Hub or other registries.

docker searchThe command helps users find and obtain the desired images, and provides the ability to filter and sort search results.

Syntax

docker search [OPTIONS] TERM
  • TERMThe keyword to search for.

Common options:

  • --automated :Only list images of the automated build type;

  • --no-trunc :Displays the full image description;

  • -f <filter>:List mirrors whose favorite count is not less than the specified value.

1. Search for images

docker search ubuntu

This searches Docker Hub for images containing the keyword ubuntu.

2. Limit the number of search results returned

docker search --limit 5 ubuntu

This searches Docker Hub for images containing the keyword ubuntu, and returns only the first 5 results.

3. Filter search results

docker search --filter stars=50 ubuntu

This searches Docker Hub for images containing the keyword ubuntu, and returns only images with no fewer than 50 stars.

4. Do not truncate output

docker search --no-trunc ubuntu

This searches Docker Hub for images containing the keyword ubuntu, and displays the full image description.

5. Custom format output

docker search --format "{{.Name}}: {{.StarCount}} stars" ubuntu

This searches Docker Hub for images containing the keyword ubuntu, and displays the image name and star count in the specified format.

Example

1. Search for Ubuntu images

docker search ubuntu
Output example:
NAME                             DESCRIPTION                                     STARS   OFFICIAL  AUTOMATED
ubuntu                           Ubuntu is a Debian-based Linux operating sys…   10000   [OK]
dorowu/ubuntu-desktop-lxde-vnc   Ubuntu with openssh-server and NoVNC            4000               [OK]
rastasheep/ubuntu-sshd           Dockerized SSH service, built on top of offi…   2000               [OK]

Parameter description:

NAME: The name of the image repository source

DESCRIPTION: Image description

OFFICIAL: Whether it is an official Docker release

stars: Similar to stars on Github, meaning to like or favorite.

AUTOMATED: Automatic build.

2. Limit the number of returned results

docker search --limit 3 ubuntu
Output example:
NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                            Ubuntu is a Debian-based Linux operating sys…   10000     [OK]
dorowu/ubuntu-desktop-lxde-vnc    Ubuntu with openssh-server and NoVNC            4000                 [OK]
rastasheep/ubuntu-sshd            Dockerized SSH service, built on top of offi…   2000                 [OK]

3. Filter search results

docker search --filter stars=1000 ubuntu

Output example:

NAME                            DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                          Ubuntu is a Debian-based Linux operating sys…   10000     [OK]
dorowu/ubuntu-desktop-lxde-vnc  Ubuntu with openssh-server and NoVNC            4000                 [OK]
rastasheep/ubuntu-sshd          Dockerized SSH service, built on top of offi…   2000                 [OK]

4. Custom format output

docker search --format "{{.Name}}: {{.StarCount}} stars" ubuntu

Output example:

ubuntu: 10000 stars
dorowu/ubuntu-desktop-lxde-vnc: 4000 stars
rastasheep/ubuntu-sshd: 2000 stars

Notes

  • Search results may contain many images, and you can use filtering and sorting options to refine the results.
  • Make sure to use accurate keywords to get relevant results.
  • docker searchBy default, Docker Hub is searched. If you need to search other registries, you need to configure the Docker client accordingly.

docker searchThe command is an important tool for finding Docker images. By specifying keywords and options, users can efficiently search and obtain the desired images in Docker registries. This command is suitable for various scenarios, including finding images with specific functions, obtaining highly rated images, and customizing result display.


Docker command reference

other extensions