github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/commandline/search.md (about) 1 # search 2 3 <!---MARKER_GEN_START--> 4 Search Docker Hub for images 5 6 ### Options 7 8 | Name | Type | Default | Description | 9 |:---------------------------------------|:---------|:--------|:-------------------------------------------| 10 | [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided | 11 | [`--format`](#format) | `string` | | Pretty-print search using a Go template | 12 | [`--limit`](#limit) | `int` | `0` | Max number of search results | 13 | [`--no-trunc`](#no-trunc) | | | Don't truncate output | 14 15 16 <!---MARKER_GEN_END--> 17 18 ## Description 19 20 Search [Docker Hub](https://hub.docker.com) for images 21 22 ## Examples 23 24 ### Search images by name 25 26 This example displays images with a name containing 'busybox': 27 28 ```console 29 $ docker search busybox 30 31 NAME DESCRIPTION STARS OFFICIAL 32 busybox Busybox base image. 316 [OK] 33 progrium/busybox 50 34 radial/busyboxplus Full-chain, Internet enabled, busybox made... 8 35 odise/busybox-python 2 36 azukiapp/busybox This image is meant to be used as the base... 2 37 ofayau/busybox-jvm Prepare busybox to install a 32 bits JVM. 1 38 shingonoide/archlinux-busybox Arch Linux, a lightweight and flexible Lin... 1 39 odise/busybox-curl 1 40 ofayau/busybox-libc32 Busybox with 32 bits (and 64 bits) libs 1 41 peelsky/zulu-openjdk-busybox 1 42 skomma/busybox-data Docker image suitable for data volume cont... 1 43 elektritter/busybox-teamspeak Lightweight teamspeak3 container based on... 1 44 socketplane/busybox 1 45 oveits/docker-nginx-busybox This is a tiny NginX docker image based on... 0 46 ggtools/busybox-ubuntu Busybox ubuntu version with extra goodies 0 47 nikfoundas/busybox-confd Minimal busybox based distribution of confd 0 48 openshift/busybox-http-app 0 49 jllopis/busybox 0 50 swyckoff/busybox 0 51 powellquiring/busybox 0 52 williamyeh/busybox-sh Docker image for BusyBox's sh 0 53 simplexsys/busybox-cli-powered Docker busybox images, with a few often us... 0 54 fhisamoto/busybox-java Busybox java 0 55 scottabernethy/busybox 0 56 marclop/busybox-solr 57 ``` 58 59 ### <a name="no-trunc"></a> Display non-truncated description (--no-trunc) 60 61 This example displays images with a name containing 'busybox', 62 at least 3 stars and the description isn't truncated in the output: 63 64 ```console 65 $ docker search --filter=stars=3 --no-trunc busybox 66 67 NAME DESCRIPTION STARS OFFICIAL 68 busybox Busybox base image. 325 [OK] 69 progrium/busybox 50 70 radial/busyboxplus Full-chain, Internet enabled, busybox made from scratch. Comes in git and cURL flavors. 8 71 ``` 72 73 ### <a name="limit"></a> Limit search results (--limit) 74 75 The flag `--limit` is the maximum number of results returned by a search. If no 76 value is set, the default is set by the daemon. 77 78 ### <a name="filter"></a> Filtering (--filter) 79 80 The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more 81 than one filter, then pass multiple flags (e.g. `--filter is-official=true --filter stars=3`). 82 83 The currently supported filters are: 84 85 - stars (int - number of stars the image has) 86 - is-automated (boolean - true or false) - is the image automated or not (deprecated) 87 - is-official (boolean - true or false) - is the image official or not 88 89 #### stars 90 91 This example displays images with a name containing 'busybox' and at 92 least 3 stars: 93 94 ```console 95 $ docker search --filter stars=3 busybox 96 97 NAME DESCRIPTION STARS OFFICIAL 98 busybox Busybox base image. 325 [OK] 99 progrium/busybox 50 100 radial/busyboxplus Full-chain, Internet enabled, busybox made... 8 101 ``` 102 103 #### is-official 104 105 This example displays images with a name containing 'busybox', at least 106 3 stars and are official builds: 107 108 ```console 109 $ docker search --filter is-official=true --filter stars=3 busybox 110 111 NAME DESCRIPTION STARS OFFICIAL 112 busybox Busybox base image. 325 [OK] 113 ``` 114 115 ### <a name="format"></a> Format the output (--format) 116 117 The formatting option (`--format`) pretty-prints search output 118 using a Go template. 119 120 Valid placeholders for the Go template are: 121 122 | Placeholder | Description | 123 |----------------|------------------------------------------------| 124 | `.Name` | Image Name | 125 | `.Description` | Image description | 126 | `.StarCount` | Number of stars for the image | 127 | `.IsOfficial` | "OK" if image is official | 128 | `.IsAutomated` | "OK" if image build was automated (deprecated) | 129 130 When you use the `--format` option, the `search` command will 131 output the data exactly as the template declares. If you use the 132 `table` directive, column headers are included as well. 133 134 The following example uses a template without headers and outputs the 135 `Name` and `StarCount` entries separated by a colon (`:`) for all images: 136 137 ```console 138 $ docker search --format "{{.Name}}: {{.StarCount}}" nginx 139 140 nginx: 5441 141 jwilder/nginx-proxy: 953 142 richarvey/nginx-php-fpm: 353 143 million12/nginx-php: 75 144 webdevops/php-nginx: 70 145 h3nrik/nginx-ldap: 35 146 bitnami/nginx: 23 147 evild/alpine-nginx: 14 148 million12/nginx: 9 149 maxexcloo/nginx: 7 150 ``` 151 152 This example outputs a table format: 153 154 ```console 155 $ docker search --format "table {{.Name}}\t{{.IsOfficial}}" nginx 156 157 NAME OFFICIAL 158 nginx [OK] 159 jwilder/nginx-proxy 160 richarvey/nginx-php-fpm 161 jrcs/letsencrypt-nginx-proxy-companion 162 million12/nginx-php 163 webdevops/php-nginx 164 ```