LinuxCommandLibrary

docker-search

Search Docker Hub for images

TLDR

Search for Docker images by name or keyword

$ docker search [keyword]
copy

Search for images and only show official ones
$ docker search [[-f|--filter]] is-official=true [keyword]
copy

Search for images and only show automated builds
$ docker search [[-f|--filter]] is-automated=true [keyword]
copy

Search for images with a minimum number of stars
$ docker search [[-f|--filter]] stars=[number] [keyword]
copy

Limit the number of results
$ docker search --limit [number] [keyword]
copy

Customize the output format
$ docker search [[-f|--format]] "[.Name]: [.Description]" [keyword]
copy

SYNOPSIS

docker search [OPTIONS] TERM

PARAMETERS

--filter, -f "filter"
    Filter output based on conditions provided. Supported filters include is-automated (true/false), is-official (true/false), stars (n, where n is a number of stars), and name (image name, supports regex).

--format "string"
    Pretty-print search results using a Go template. This is useful for scripting or generating customized output formats.

--limit int
    Specifies the maximum number of search results to return. The default limit is 25.

--no-trunc
    Prevents truncation of output. By default, descriptions and image names might be shortened for readability.

--help
    Prints a usage statement and exits.

DESCRIPTION

The docker search command allows users to search the Docker Hub registry for available Docker images. It is a fundamental tool for discovering new images by providing a search term. The command queries the official Docker Hub by default, returning a list of images that match the specified criteria.

Results typically include the image name, a brief description, the number of stars (a popularity indicator), and flags indicating if the image is an official build or an automated build. Users can refine their search by filtering results based on various conditions, such as the number of stars, official status, or automation status. Additionally, the number of returned items can be limited. This command is crucial for exploring the vast ecosystem of pre-built container images and identifying suitable base images for applications.

CAVEATS

The docker search command primarily searches the public Docker Hub registry. It does not search private registries or local images unless configured specifically through Docker's daemon configuration (which is generally outside the scope of this command's direct functionality). Network connectivity is required to perform searches, as it interacts with a remote service. Results are ordered by relevance, with star count being a strong indicator of an image's popularity and reliability.

OUTPUT COLUMNS

When you run docker search, the output typically displays several columns of information for each matching image:

  • NAME: The full name of the image (e.g., ubuntu, nginx).
  • DESCRIPTION: A brief text description provided by the image publisher.
  • STARS: The number of users who have 'starred' the image, indicating its popularity and community approval.
  • OFFICIAL: Indicates if the image is officially supported by Docker or the software vendor (e.g., [OK] for official images).
  • AUTOMATED: Indicates if the image was built via an automated Docker Hub build process linked to a source code repository (e.g., [OK] for automated builds).

HISTORY

The docker search command has been a fundamental component of the Docker CLI since its early versions, providing users with an intuitive way to discover and utilize the growing collection of container images available on Docker Hub. Its core functionality, which allows users to query the public registry, has remained consistent. Over time, incremental improvements, such as enhanced filtering and formatting options, have been added to improve usability and scriptability, reinforcing Docker's vision of an open and accessible container ecosystem.

SEE ALSO

docker pull(1), docker images(1), docker run(1)

Copied to clipboard