翼度科技»论坛 云主机 服务器技术 查看内容

docker search命令的具体使用

8

主题

8

帖子

24

积分

新手上路

Rank: 1

积分
24
一、docker search 命令选项

命令选项描述–filter , -f根据给定的条件进行过滤–format自定义打印格式–limit显示搜索结果,默认值25–no-trunc回显结果不进行截断,全部显示
二、docker search 使用实例


2.1 通过指定镜像名搜索
  1. [root@redrose2100 ~]# docker search busybox
  2. NAME                                DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
  3. busybox                             Busybox base image.                             2754      [OK]
  4. radial/busyboxplus                  Full-chain, Internet enabled, busybox made f…   49                   [OK]
  5. yauritux/busybox-curl               Busybox with CURL                               18
  6. arm32v7/busybox                     Busybox base image.                             10
  7. arm64v8/busybox                     Busybox base image.                             4
  8. odise/busybox-curl                                                                  4                    [OK]
  9. i386/busybox                        Busybox base image.                             3
  10. p7ppc64/busybox                     Busybox base image for ppc64.                   2
  11. s390x/busybox                       Busybox base image.                             2
  12. prom/busybox                        Prometheus Busybox Docker base images           2                    [OK]
  13. busybox42/zimbra-docker-centos      A Zimbra Docker image, based in ZCS 8.8.9 an…   2                    [OK]
  14. joeshaw/busybox-nonroot             Busybox container with non-root user nobody     2
  15. vukomir/busybox                     busybox and curl                                1
  16. spotify/busybox                     Spotify fork of https://hub.docker.com/_/bus…   1
  17. busybox42/haraka-docker-centos      CentOS Haraka build with spamassassin, redis…   1                    [OK]
  18. ppc64le/busybox                     Busybox base image.                             1
  19. amd64/busybox                       Busybox base image.                             1
  20. busybox42/nginx_php-docker-centos   This is a nginx/php-fpm server running on Ce…   1                    [OK]
  21. ibmcom/busybox-ppc64le                                                              0
  22. busybox42/alpine-pod                                                                0
  23. antrea/busybox                                                                      0
  24. openebs/busybox-client                                                              0
  25. ibmcom/busybox                                                                      0
  26. rancher/busybox                                                                     0
  27. ibmcom/busybox-amd64                                                                0
  28. [root@redrose2100 ~]#
复制代码
2.2 搜索结果不进行截断显示
  1. [root@redrose2100 ~]# docker search busybox --no-trunc
  2. NAME                                DESCRIPTION                                                                                 STARS     OFFICIAL   AUTOMATED
  3. busybox                             Busybox base image.                                                                         2754      [OK]
  4. radial/busyboxplus                  Full-chain, Internet enabled, busybox made from scratch. Comes in git and cURL flavors.     49                   [OK]
  5. yauritux/busybox-curl               Busybox with CURL                                                                           18
  6. arm32v7/busybox                     Busybox base image.                                                                         10
  7. odise/busybox-curl                                                                                                              4                    [OK]
  8. arm64v8/busybox                     Busybox base image.                                                                         4
  9. i386/busybox                        Busybox base image.                                                                         3
  10. p7ppc64/busybox                     Busybox base image for ppc64.                                                               2
  11. s390x/busybox                       Busybox base image.                                                                         2
  12. prom/busybox                        Prometheus Busybox Docker base images                                                       2                    [OK]
  13. busybox42/zimbra-docker-centos      A Zimbra Docker image, based in ZCS 8.8.9 and CentOS 7.                                     2                    [OK]
  14. joeshaw/busybox-nonroot             Busybox container with non-root user nobody                                                 2
  15. vukomir/busybox                     busybox and curl                                                                            1
  16. spotify/busybox                     Spotify fork of https://hub.docker.com/_/busybox/ for testing helios.                       1
  17. busybox42/haraka-docker-centos      CentOS Haraka build with spamassassin, redis and some other things.  Experimental still..   1                    [OK]
  18. ppc64le/busybox                     Busybox base image.                                                                         1
  19. amd64/busybox                       Busybox base image.                                                                         1
  20. busybox42/nginx_php-docker-centos   This is a nginx/php-fpm server running on CentOS 7.                                         1                    [OK]
  21. ibmcom/busybox-ppc64le                                                                                                          0
  22. antrea/busybox                                                                                                                  0
  23. busybox42/alpine-pod                                                                                                            0
  24. openebs/busybox-client                                                                                                          0
  25. ibmcom/busybox                                                                                                                  0
  26. rancher/busybox                                                                                                                 0
  27. ibmcom/busybox-amd64                                                                                                            0
  28. [root@redrose2100 ~]#
复制代码
2.3 设置搜索结果只显示10个
  1. [root@redrose2100 ~]# docker search busybox --limit=10
  2. NAME                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
  3. busybox                  Busybox base image.                             2754      [OK]
  4. radial/busyboxplus       Full-chain, Internet enabled, busybox made f…   49                   [OK]
  5. yauritux/busybox-curl    Busybox with CURL                               18
  6. vukomir/busybox          busybox and curl                                1
  7. antrea/busybox                                                           0
  8. ibmcom/busybox-amd64                                                     0
  9. ibmcom/busybox-ppc64le                                                   0
  10. rancher/busybox                                                          0
  11. ibmcom/busybox                                                           0
  12. openebs/busybox-client                                                   0
  13. [root@redrose2100 ~]#
复制代码
2.4 搜索结果过滤star收藏数量大于等于3个
  1. [root@redrose2100 ~]# docker search busybox --filter stars=3
  2. NAME                    DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
  3. busybox                 Busybox base image.                             2754      [OK]
  4. radial/busyboxplus      Full-chain, Internet enabled, busybox made f…   49                   [OK]
  5. yauritux/busybox-curl   Busybox with CURL                               18
  6. arm32v7/busybox         Busybox base image.                             10
  7. odise/busybox-curl                                                      4                    [OK]
  8. arm64v8/busybox         Busybox base image.                             4
  9. i386/busybox            Busybox base image.                             3
  10. [root@redrose2100 ~]#
复制代码
2.5 搜索结果只列出自动构建的镜像
  1. [root@redrose2100 ~]# docker search busybox --filter is-automated=true
  2. NAME                                DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
  3. radial/busyboxplus                  Full-chain, Internet enabled, busybox made f…   49                   [OK]
  4. odise/busybox-curl                                                                  4                    [OK]
  5. busybox42/zimbra-docker-centos      A Zimbra Docker image, based in ZCS 8.8.9 an…   2                    [OK]
  6. prom/busybox                        Prometheus Busybox Docker base images           2                    [OK]
  7. busybox42/haraka-docker-centos      CentOS Haraka build with spamassassin, redis…   1                    [OK]
  8. busybox42/nginx_php-docker-centos   This is a nginx/php-fpm server running on Ce…   1                    [OK]
  9. [root@redrose2100 ~]#
复制代码
2.6 搜索结果只列出官方镜像
  1. [root@redrose2100 ~]# docker search busybox --filter is-official=true
  2. NAME      DESCRIPTION           STARS     OFFICIAL   AUTOMATED
  3. busybox   Busybox base image.   2754      [OK]
  4. [root@redrose2100 ~]#
复制代码
2.7 搜索结果通过多个条件过滤

如下为过滤自动构建的并且收藏数量大于等于3的镜像
  1. [root@redrose2100 ~]# docker search busybox --filter is-automated=true --filter stars=3
  2. NAME                 DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
  3. radial/busyboxplus   Full-chain, Internet enabled, busybox made f…   49                   [OK]
  4. odise/busybox-curl                                                   4                    [OK]
  5. [root@redrose2100 ~]#
复制代码
2.8 定制自定义打印输出格式

docker search 可以通过 --format 参数定制自定义打印格式,可自定义的占位字段如下:
占位符描述.Name镜像名称.Description镜像描述.StarCount镜像被收藏数量.IsOfficial镜像是否为官方镜像,如果是现实“OK”.IsAutomated镜像是否为自动构建,如果是显示“OK”如下为搜索nginx镜像,只显示镜像名称和镜像被收藏数量
  1. [root@redrose2100 ~]# docker search --format "{{.Name}}: {{.StarCount}}" nginx
  2. nginx: 17429
  3. linuxserver/nginx: 178
  4. bitnami/nginx: 140
  5. ubuntu/nginx: 61
  6. bitnami/nginx-ingress-controller: 20
  7. rancher/nginx-ingress-controller: 11
  8. webdevops/nginx: 10
  9. ibmcom/nginx-ingress-controller: 4
  10. bitnami/nginx-ldap-auth-daemon: 3
  11. rancher/nginx: 2
  12. kasmweb/nginx: 2
  13. vmware/nginx: 2
  14. rancher/nginx-ingress-controller-defaultbackend: 2
  15. rapidfort/nginx: 2
  16. bitnami/nginx-exporter: 2
  17. wallarm/nginx-ingress-controller: 1
  18. vmware/nginx-photon: 1
  19. bitnami/nginx-intel: 1
  20. rapidfort/nginx-ib: 0
  21. ibmcom/nginx-ingress-controller-ppc64le: 0
  22. rancher/nginx-conf: 0
  23. rancher/nginx-ssl: 0
  24. continuumio/nginx-ingress-ws: 0
  25. rancher/nginx-ingress-controller-amd64: 0
  26. ibmcom/nginx-ppc64le: 0
  27. [root@redrose2100 ~]#
复制代码
如下,格式化显示镜像名称、镜像被收藏数量、镜像是否自动构建、镜像是否官方
  1. [root@redrose2100 ~]# docker search --format "table {{.Name}}\t\t{{.StarCount}}\t\t{{.IsAutomated}}\t\t{{.IsOfficial}}" nginx
  2. NAME                                                        STARS               AUTOMATED             OFFICIAL
  3. nginx                                                       17429                                     [OK]
  4. linuxserver/nginx                                           178
  5. bitnami/nginx                                               140                 [OK]
  6. ubuntu/nginx                                                61
  7. bitnami/nginx-ingress-controller                            20                  [OK]
  8. rancher/nginx-ingress-controller                            11
  9. webdevops/nginx                                             10                  [OK]
  10. ibmcom/nginx-ingress-controller                             4
  11. bitnami/nginx-ldap-auth-daemon                              3
  12. rancher/nginx                                               2
  13. kasmweb/nginx                                               2
  14. vmware/nginx                                                2
  15. rancher/nginx-ingress-controller-defaultbackend             2
  16. rapidfort/nginx                                             2
  17. bitnami/nginx-exporter                                      2
  18. wallarm/nginx-ingress-controller                            1
  19. vmware/nginx-photon                                         1
  20. bitnami/nginx-intel                                         1
  21. rapidfort/nginx-ib                                          0
  22. rancher/nginx-conf                                          0
  23. ibmcom/nginx-ingress-controller-ppc64le                     0
  24. rancher/nginx-ssl                                           0
  25. continuumio/nginx-ingress-ws                                0
  26. rancher/nginx-ingress-controller-amd64                      0
  27. ibmcom/nginx-ppc64le                                        0
  28. [root@redrose2100 ~]#
复制代码
到此这篇关于docker search命令的具体使用的文章就介绍到这了,更多相关docker search命令内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

来源:https://www.jb51.net/article/275168.htm
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

举报 回复 使用道具