docker search
docker search
Docker Hub에서 이미지를 검색하는 명령어예요.
출처: 문서
본문
docker search는 Docker Hub에서 이미지를 검색해요.
Usage: docker search [OPTIONS] TERM
옵션
| 옵션 | 기본값 | 설명 |
|---|---|---|
-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
더 알아보기
- 이미지 내려받기는 docker image pull