首頁 > 軟體

docker search命令的具體使用

2023-02-14 06:00:03

一、docker search 命令選項

命令選項描述
–filter , -f根據給定的條件進行過濾
–format自定義列印格式
–limit顯示搜尋結果,預設值25
–no-trunc回顯結果不進行截斷,全部顯示

二、docker search 使用範例

2.1 通過指定映象名搜尋

[root@redrose2100 ~]# docker search busybox
NAME                                DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
busybox                             Busybox base image.                             2754      [OK]
radial/busyboxplus                  Full-chain, Internet enabled, busybox made f…   49                   [OK]
yauritux/busybox-curl               Busybox with CURL                               18
arm32v7/busybox                     Busybox base image.                             10
arm64v8/busybox                     Busybox base image.                             4
odise/busybox-curl                                                                  4                    [OK]
i386/busybox                        Busybox base image.                             3
p7ppc64/busybox                     Busybox base image for ppc64.                   2
s390x/busybox                       Busybox base image.                             2
prom/busybox                        Prometheus Busybox Docker base images           2                    [OK]
busybox42/zimbra-docker-centos      A Zimbra Docker image, based in ZCS 8.8.9 an…   2                    [OK]
joeshaw/busybox-nonroot             Busybox container with non-root user nobody     2
vukomir/busybox                     busybox and curl                                1
spotify/busybox                     Spotify fork of https://hub.docker.com/_/bus…   1
busybox42/haraka-docker-centos      CentOS Haraka build with spamassassin, redis…   1                    [OK]
ppc64le/busybox                     Busybox base image.                             1
amd64/busybox                       Busybox base image.                             1
busybox42/nginx_php-docker-centos   This is a nginx/php-fpm server running on Ce…   1                    [OK]
ibmcom/busybox-ppc64le                                                              0
busybox42/alpine-pod                                                                0
antrea/busybox                                                                      0
openebs/busybox-client                                                              0
ibmcom/busybox                                                                      0
rancher/busybox                                                                     0
ibmcom/busybox-amd64                                                                0
[root@redrose2100 ~]#

2.2 搜尋結果不進行截斷顯示

[root@redrose2100 ~]# docker search busybox --no-trunc
NAME                                DESCRIPTION                                                                                 STARS     OFFICIAL   AUTOMATED
busybox                             Busybox base image.                                                                         2754      [OK]
radial/busyboxplus                  Full-chain, Internet enabled, busybox made from scratch. Comes in git and cURL flavors.     49                   [OK]
yauritux/busybox-curl               Busybox with CURL                                                                           18
arm32v7/busybox                     Busybox base image.                                                                         10
odise/busybox-curl                                                                                                              4                    [OK]
arm64v8/busybox                     Busybox base image.                                                                         4
i386/busybox                        Busybox base image.                                                                         3
p7ppc64/busybox                     Busybox base image for ppc64.                                                               2
s390x/busybox                       Busybox base image.                                                                         2
prom/busybox                        Prometheus Busybox Docker base images                                                       2                    [OK]
busybox42/zimbra-docker-centos      A Zimbra Docker image, based in ZCS 8.8.9 and CentOS 7.                                     2                    [OK]
joeshaw/busybox-nonroot             Busybox container with non-root user nobody                                                 2
vukomir/busybox                     busybox and curl                                                                            1
spotify/busybox                     Spotify fork of https://hub.docker.com/_/busybox/ for testing helios.                       1
busybox42/haraka-docker-centos      CentOS Haraka build with spamassassin, redis and some other things.  Experimental still..   1                    [OK]
ppc64le/busybox                     Busybox base image.                                                                         1
amd64/busybox                       Busybox base image.                                                                         1
busybox42/nginx_php-docker-centos   This is a nginx/php-fpm server running on CentOS 7.                                         1                    [OK]
ibmcom/busybox-ppc64le                                                                                                          0
antrea/busybox                                                                                                                  0
busybox42/alpine-pod                                                                                                            0
openebs/busybox-client                                                                                                          0
ibmcom/busybox                                                                                                                  0
rancher/busybox                                                                                                                 0
ibmcom/busybox-amd64                                                                                                            0
[root@redrose2100 ~]#

2.3 設定搜尋結果只顯示10個

[root@redrose2100 ~]# docker search busybox --limit=10
NAME                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
busybox                  Busybox base image.                             2754      [OK]
radial/busyboxplus       Full-chain, Internet enabled, busybox made f…   49                   [OK]
yauritux/busybox-curl    Busybox with CURL                               18
vukomir/busybox          busybox and curl                                1
antrea/busybox                                                           0
ibmcom/busybox-amd64                                                     0
ibmcom/busybox-ppc64le                                                   0
rancher/busybox                                                          0
ibmcom/busybox                                                           0
openebs/busybox-client                                                   0
[root@redrose2100 ~]#

2.4 搜尋結果過濾star收藏數量大於等於3個

[root@redrose2100 ~]# docker search busybox --filter stars=3
NAME                    DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
busybox                 Busybox base image.                             2754      [OK]
radial/busyboxplus      Full-chain, Internet enabled, busybox made f…   49                   [OK]
yauritux/busybox-curl   Busybox with CURL                               18
arm32v7/busybox         Busybox base image.                             10
odise/busybox-curl                                                      4                    [OK]
arm64v8/busybox         Busybox base image.                             4
i386/busybox            Busybox base image.                             3
[root@redrose2100 ~]#

2.5 搜尋結果只列出自動構建的映象

[root@redrose2100 ~]# docker search busybox --filter is-automated=true
NAME                                DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
radial/busyboxplus                  Full-chain, Internet enabled, busybox made f…   49                   [OK]
odise/busybox-curl                                                                  4                    [OK]
busybox42/zimbra-docker-centos      A Zimbra Docker image, based in ZCS 8.8.9 an…   2                    [OK]
prom/busybox                        Prometheus Busybox Docker base images           2                    [OK]
busybox42/haraka-docker-centos      CentOS Haraka build with spamassassin, redis…   1                    [OK]
busybox42/nginx_php-docker-centos   This is a nginx/php-fpm server running on Ce…   1                    [OK]
[root@redrose2100 ~]#

2.6 搜尋結果只列出官方映象

[root@redrose2100 ~]# docker search busybox --filter is-official=true
NAME      DESCRIPTION           STARS     OFFICIAL   AUTOMATED
busybox   Busybox base image.   2754      [OK]
[root@redrose2100 ~]#

2.7 搜尋結果通過多個條件過濾

如下為過濾自動構建的並且收藏數量大於等於3的映象

[root@redrose2100 ~]# docker search busybox --filter is-automated=true --filter stars=3
NAME                 DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
radial/busyboxplus   Full-chain, Internet enabled, busybox made f…   49                   [OK]
odise/busybox-curl                                                   4                    [OK]
[root@redrose2100 ~]#

2.8 客製化自定義列印輸出格式

docker search 可以通過 --format 引數客製化自定義列印格式,可自定義的佔位欄位如下:

預留位置描述
.Name映象名稱
.Description映象描述
.StarCount映象被收藏數量
.IsOfficial映象是否為官方映象,如果是現實“OK”
.IsAutomated映象是否為自動構建,如果是顯示“OK”

如下為搜尋nginx映象,只顯示映象名稱和映象被收藏數量

[root@redrose2100 ~]# docker search --format "{{.Name}}: {{.StarCount}}" nginx
nginx: 17429
linuxserver/nginx: 178
bitnami/nginx: 140
ubuntu/nginx: 61
bitnami/nginx-ingress-controller: 20
rancher/nginx-ingress-controller: 11
webdevops/nginx: 10
ibmcom/nginx-ingress-controller: 4
bitnami/nginx-ldap-auth-daemon: 3
rancher/nginx: 2
kasmweb/nginx: 2
vmware/nginx: 2
rancher/nginx-ingress-controller-defaultbackend: 2
rapidfort/nginx: 2
bitnami/nginx-exporter: 2
wallarm/nginx-ingress-controller: 1
vmware/nginx-photon: 1
bitnami/nginx-intel: 1
rapidfort/nginx-ib: 0
ibmcom/nginx-ingress-controller-ppc64le: 0
rancher/nginx-conf: 0
rancher/nginx-ssl: 0
continuumio/nginx-ingress-ws: 0
rancher/nginx-ingress-controller-amd64: 0
ibmcom/nginx-ppc64le: 0
[root@redrose2100 ~]#

如下,格式化顯示映象名稱、映象被收藏數量、映象是否自動構建、映象是否官方

[root@redrose2100 ~]# docker search --format "table {{.Name}}tt{{.StarCount}}tt{{.IsAutomated}}tt{{.IsOfficial}}" nginx
NAME                                                        STARS               AUTOMATED             OFFICIAL
nginx                                                       17429                                     [OK]
linuxserver/nginx                                           178
bitnami/nginx                                               140                 [OK]
ubuntu/nginx                                                61
bitnami/nginx-ingress-controller                            20                  [OK]
rancher/nginx-ingress-controller                            11
webdevops/nginx                                             10                  [OK]
ibmcom/nginx-ingress-controller                             4
bitnami/nginx-ldap-auth-daemon                              3
rancher/nginx                                               2
kasmweb/nginx                                               2
vmware/nginx                                                2
rancher/nginx-ingress-controller-defaultbackend             2
rapidfort/nginx                                             2
bitnami/nginx-exporter                                      2
wallarm/nginx-ingress-controller                            1
vmware/nginx-photon                                         1
bitnami/nginx-intel                                         1
rapidfort/nginx-ib                                          0
rancher/nginx-conf                                          0
ibmcom/nginx-ingress-controller-ppc64le                     0
rancher/nginx-ssl                                           0
continuumio/nginx-ingress-ws                                0
rancher/nginx-ingress-controller-amd64                      0
ibmcom/nginx-ppc64le                                        0
[root@redrose2100 ~]#

到此這篇關於docker search命令的具體使用的文章就介紹到這了,更多相關docker search命令內容請搜尋it145.com以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援it145.com!


IT145.com E-mail:sddin#qq.com