docker buildx ls
현재 사용중인 builder는 *이 표시됨.
$ docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
default * docker
default default running v0.11.6+616c3f613b54 linux/amd64,
linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le,
linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
docker buildx create [OPTIONS] [CONTEXT|ENDPOINT]
| Option | Short | Default | Description |
|---|---|---|---|
| --driver | 사용할 드라이버를 설정 ( docker-container , kubernetes , remote ) | ||
| --driver-opt | 드라이버에 따른 옵션을 설정 | ||
| --name | builder 이름을 지정 | ||
| --platform | platform 을 지정 | ||
| --use | 생성 후 해당 builder 를 사용 |
| Feature | docker | docker-container | kubernetes | remote |
|---|---|---|---|---|
| Automatically load | ✅ | |||
| Cache export | ✓* | ✅ | ✅ | ✅ |
| Tarball output | ✅ | ✅ | ✅ | |
| Multi-arch images | ✅ | ✅ | ✅ | |
| BuildKit configuration | ✅ | ✅ | Managed externally |
$ docker buildx create --driver docker-container --name multi-builder --platform
linux/amd64,linux/arm64
$ docker buildx inspect multi-builder
Name: multi-builder
Driver: docker-container
Last Activity: 2024-07-07 06:39:02 +0000 UTC
Nodes:
Name: multi-builder0
Endpoint: npipe:////./pipe/docker_engine
Status: inactive
Platforms: linux/amd64*, linux/arm64*
docker buildx inspect [NAME]
$ docker buildx inspect --bootstrap
Name: default
Driver: docker
Last Activity: 2023-12-22 02:37:31 +0000 UTC
Nodes:
Name: default
Endpoint: default
Status: running
Buildkit: v0.11.6+616c3f613b54
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64,
linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le,
linux/mips64, linux/arm/v7, linux/arm/v6
Labels:
org.mobyproject.buildkit.worker.moby.host-gateway-ip: 192.168.65.254
GC Policy rule#0:
All: false
Filters:
type==source.local,type==exec.cachemount,type==source.git.checkout
Keep Duration: 172.8µs
Keep Bytes: 2.764GiB
GC Policy rule#1:
All: false
Keep Duration: 5.184ms
Keep Bytes: 20GiB
GC Policy rule#2:
All: false
Keep Bytes: 20GiB
GC Policy rule#3:
All: true
Keep Bytes: 20GiB
docker buildx use [OPTIONS] NAME
option : --default - default로 설정
docker buildx build [OPTIONS] PATH | URL | -
| Option | Short | Default | Description |
|---|---|---|---|
| --build-arg | ARG 를 설정 | ||
| --file | -f | Dockerfile 의 경로를 지정 | |
| --label | 라벨을 추가 | ||
| --no-cache | 이미지 빌드시 캐시를 사용 X | ||
| --platform | platform 을 지정 | ||
| --pull | 관련된 이미지를 저장 유무에 관계없이 pull | ||
| --load | 이미지를 host 에 저장 (--output=type=docker) | ||
| --push | 이미지를 registry 에 저장 (--output=type=registry) | ||
| --tag | -t | 이름과 Tag 를 설정 |
docker 드라이버를 사용하는 builder 는 단일 platform 이미지만 빌드할 수 있다.
docker 드라이버가 아닌 다른 드라이버를 사용하는 경우 --load 를 사용하여야 이미지를 가져올
수 있다.
--load 는 export 를 이용하여 이미지를 추출하고 import 한다.
2개 이상의 platform 을 지원하는 이미지를 제작하는 경우 --load 가 불가능하므로 --push 를 통해 registry 로 바로 업로드해야 한다.