Docker 搜索镜像

更新时间 2022-07-05 14:32:27

一、search 命令

在 Docker 中,通过如下命令搜索镜像:

docker search [option] keyword

比如,你想搜索仓库中 mysql 相关的镜像,可以输入如下命令:

docker search mysql

Docker 搜索镜像Docker 搜索镜像

返回字段说明:

  • NAME : 镜像名称;
  • DESCRIPTION : 镜像描述信息;
  • STARS : 用户标星数;
  • OFFICIAL: 是否为官方提供,[OK]表示为官方提供;

二、search 命令支持的参数

命令行执行 docker search --help, 可以知道 search 命令支持的参数:

Usage:  docker search [OPTIONS] TERM

Search the Docker Hub for images

Options:
  -f, --filter filter   Filter output based on conditions provided
      --help            Print usage
      --limit int       Max number of search results (default 25)
      --no-index        Don't truncate output
      --no-trunc        Don't truncate output

参数说明:

  • -f, --filter filter: 过滤输出的内容;
  • --limit int:指定搜索内容展示个数;
  • --no-index: 不截断输出内容;
  • --no-trunc:不截断输出内容;

举个例子🌰,比如想搜索 Stars 数超过 100 的 mysql 镜像:

docker search --filter=stars=100 mysql

Docker 搜索镜像Docker 搜索镜像