docker search

描述在 Docker Hub 上搜索映象
用法docker search [OPTIONS] TERM

描述

Docker Hub 上搜索映象

選項

選項預設值描述
-f, --filter根據提供的條件篩選輸出
--format使用 Go 模板美化搜尋結果
--limit最大搜索結果數量
--no-trunc不截斷輸出

示例

按名稱搜尋映象

此示例顯示名稱中包含“busybox”的映象

$ docker search busybox

NAME                             DESCRIPTION                                     STARS     OFFICIAL
busybox                          Busybox base image.                             316       [OK]
progrium/busybox                                                                 50
radial/busyboxplus               Full-chain, Internet enabled, busybox made...   8
odise/busybox-python                                                             2
azukiapp/busybox                 This image is meant to be used as the base...   2
ofayau/busybox-jvm               Prepare busybox to install a 32 bits JVM.       1
shingonoide/archlinux-busybox    Arch Linux, a lightweight and flexible Lin...   1
odise/busybox-curl                                                               1
ofayau/busybox-libc32            Busybox with 32 bits (and 64 bits) libs         1
peelsky/zulu-openjdk-busybox                                                     1
skomma/busybox-data              Docker image suitable for data volume cont...   1
elektritter/busybox-teamspeak    Lightweight teamspeak3 container based on...    1
socketplane/busybox                                                              1
oveits/docker-nginx-busybox      This is a tiny NginX docker image based on...   0
ggtools/busybox-ubuntu           Busybox ubuntu version with extra goodies       0
nikfoundas/busybox-confd         Minimal busybox based distribution of confd     0
openshift/busybox-http-app                                                       0
jllopis/busybox                                                                  0
swyckoff/busybox                                                                 0
powellquiring/busybox                                                            0
williamyeh/busybox-sh            Docker image for BusyBox's sh                   0
simplexsys/busybox-cli-powered   Docker busybox images, with a few often us...   0
fhisamoto/busybox-java           Busybox java                                    0
scottabernethy/busybox                                                           0
marclop/busybox-solr

顯示未截斷的描述 (--no-trunc)

此示例顯示名稱中包含“busybox”、至少有 3 顆星且描述在輸出中未截斷的映象

$ docker search --filter=stars=3 --no-trunc busybox

NAME                 DESCRIPTION                                                                               STARS     OFFICIAL
busybox              Busybox base image.                                                                       325       [OK]
progrium/busybox                                                                                               50
radial/busyboxplus   Full-chain, Internet enabled, busybox made from scratch. Comes in git and cURL flavors.   8

限制搜尋結果 (--limit)

`--limit` 標誌是搜尋返回的最大結果數量。如果未設定值,則預設值由守護程式設定。

過濾 (--filter)

過濾標誌 (`-f` 或 `--filter`) 的格式是 `key=value` 對。如果存在多個過濾器,則傳遞多個標誌(例如,`--filter is-official=true --filter stars=3`)。

目前支援的過濾器有:

  • stars (int - 映象的星數)
  • is-automated (boolean - true 或 false) - 映象是否自動化(已棄用)
  • is-official (boolean - true 或 false) - 映象是否為官方映象

stars

此示例顯示名稱中包含“busybox”且至少有 3 顆星的映象

$ docker search --filter stars=3 busybox

NAME                 DESCRIPTION                                     STARS     OFFICIAL
busybox              Busybox base image.                             325       [OK]
progrium/busybox                                                     50
radial/busyboxplus   Full-chain, Internet enabled, busybox made...   8

is-official

此示例顯示名稱中包含“busybox”、至少有 3 顆星且是官方構建的映象

$ docker search --filter is-official=true --filter stars=3 busybox

NAME      DESCRIPTION           STARS     OFFICIAL
busybox   Busybox base image.   325       [OK]

格式化輸出 (--format)

格式化選項 (`--format`) 使用 Go 模板美化搜尋輸出。

Go 模板的有效佔位符是:

佔位符描述
.Name映象名稱
.Description映象描述
.StarCount映象的星數
.IsOfficial如果映象是官方的,則顯示“OK”

當您使用 `--format` 選項時,`search` 命令將完全按照模板宣告的方式輸出資料。如果您使用 `table` 指令,則也會包含列標題。

以下示例使用不帶標題的模板,並輸出所有映象的 `Name` 和 `StarCount` 條目,以冒號 (`:`) 分隔。

$ docker search --format "{{.Name}}: {{.StarCount}}" nginx

nginx: 5441
jwilder/nginx-proxy: 953
richarvey/nginx-php-fpm: 353
million12/nginx-php: 75
webdevops/php-nginx: 70
h3nrik/nginx-ldap: 35
bitnami/nginx: 23
evild/alpine-nginx: 14
million12/nginx: 9
maxexcloo/nginx: 7

此示例輸出表格格式

$ docker search --format "table {{.Name}}\t{{.IsOfficial}}" nginx

NAME                                     OFFICIAL
nginx                                    [OK]
jwilder/nginx-proxy
richarvey/nginx-php-fpm
jrcs/letsencrypt-nginx-proxy-companion
million12/nginx-php
webdevops/php-nginx