文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

docker search命令如何使用

2023-07-05 03:42

关注

本文小编为大家详细介绍“docker search命令如何使用”,内容详细,步骤清晰,细节处理妥当,希望这篇“docker search命令如何使用”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

一、docker search 命令选项

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

二、docker search 使用实例

2.1 通过指定镜像名搜索

[root@redrose2100 ~]# docker search busyboxNAME                                DESCRIPTION                                     STARS     OFFICIAL   AUTOMATEDbusybox                             Busybox base image.                             2754      [OK]radial/busyboxplus                  Full-chain, Internet enabled, busybox made f…   49                   [OK]yauritux/busybox-curl               Busybox with CURL                               18arm32v7/busybox                     Busybox base image.                             10arm64v8/busybox                     Busybox base image.                             4odise/busybox-curl                                                                  4                    [OK]i386/busybox                        Busybox base image.                             3p7ppc64/busybox                     Busybox base image for ppc64.                   2s390x/busybox                       Busybox base image.                             2prom/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     2vukomir/busybox                     busybox and curl                                1spotify/busybox                     Spotify fork of https://hub.docker.com/_/bus…   1busybox42/haraka-docker-centos      CentOS Haraka build with spamassassin, redis…   1                    [OK]ppc64le/busybox                     Busybox base image.                             1amd64/busybox                       Busybox base image.                             1busybox42/nginx_php-docker-centos   This is a nginx/php-fpm server running on Ce…   1                    [OK]ibmcom/busybox-ppc64le                                                              0busybox42/alpine-pod                                                                0antrea/busybox                                                                      0openebs/busybox-client                                                              0ibmcom/busybox                                                                      0rancher/busybox                                                                     0ibmcom/busybox-amd64                                                                0[root@redrose2100 ~]#

2.2 搜索结果不进行截断显示

[root@redrose2100 ~]# docker search busybox --no-truncNAME                                DESCRIPTION                                                                                 STARS     OFFICIAL   AUTOMATEDbusybox                             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                                                                           18arm32v7/busybox                     Busybox base image.                                                                         10odise/busybox-curl                                                                                                              4                    [OK]arm64v8/busybox                     Busybox base image.                                                                         4i386/busybox                        Busybox base image.                                                                         3p7ppc64/busybox                     Busybox base image for ppc64.                                                               2s390x/busybox                       Busybox base image.                                                                         2prom/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                                                 2vukomir/busybox                     busybox and curl                                                                            1spotify/busybox                     Spotify fork of https://hub.docker.com/_/busybox/ for testing helios.                       1busybox42/haraka-docker-centos      CentOS Haraka build with spamassassin, redis and some other things.  Experimental still..   1                    [OK]ppc64le/busybox                     Busybox base image.                                                                         1amd64/busybox                       Busybox base image.                                                                         1busybox42/nginx_php-docker-centos   This is a nginx/php-fpm server running on CentOS 7.                                         1                    [OK]ibmcom/busybox-ppc64le                                                                                                          0antrea/busybox                                                                                                                  0busybox42/alpine-pod                                                                                                            0openebs/busybox-client                                                                                                          0ibmcom/busybox                                                                                                                  0rancher/busybox                                                                                                                 0ibmcom/busybox-amd64                                                                                                            0[root@redrose2100 ~]#

2.3 设置搜索结果只显示10个

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

2.4 搜索结果过滤star收藏数量大于等于3个

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

2.5 搜索结果只列出自动构建的镜像

[root@redrose2100 ~]# docker search busybox --filter is-automated=trueNAME                                DESCRIPTION                                     STARS     OFFICIAL   AUTOMATEDradial/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=trueNAME      DESCRIPTION           STARS     OFFICIAL   AUTOMATEDbusybox   Busybox base image.   2754      [OK][root@redrose2100 ~]#

2.7 搜索结果通过多个条件过滤

如下为过滤自动构建的并且收藏数量大于等于3的镜像

[root@redrose2100 ~]# docker search busybox --filter is-automated=true --filter stars=3NAME                 DESCRIPTION                                     STARS     OFFICIAL   AUTOMATEDradial/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}}" nginxnginx: 17429linuxserver/nginx: 178bitnami/nginx: 140ubuntu/nginx: 61bitnami/nginx-ingress-controller: 20rancher/nginx-ingress-controller: 11webdevops/nginx: 10ibmcom/nginx-ingress-controller: 4bitnami/nginx-ldap-auth-daemon: 3rancher/nginx: 2kasmweb/nginx: 2vmware/nginx: 2rancher/nginx-ingress-controller-defaultbackend: 2rapidfort/nginx: 2bitnami/nginx-exporter: 2wallarm/nginx-ingress-controller: 1vmware/nginx-photon: 1bitnami/nginx-intel: 1rapidfort/nginx-ib: 0ibmcom/nginx-ingress-controller-ppc64le: 0rancher/nginx-conf: 0rancher/nginx-ssl: 0continuumio/nginx-ingress-ws: 0rancher/nginx-ingress-controller-amd64: 0ibmcom/nginx-ppc64le: 0[root@redrose2100 ~]#

如下,格式化显示镜像名称、镜像被收藏数量、镜像是否自动构建、镜像是否官方

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

读到这里,这篇“docker search命令如何使用”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注编程网行业资讯频道。

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯