BuildKit on Cloud Build
2021/6/18
今は普通に使えると思う
code:cloudbuild.yaml
options:
env:
- DOCKER_BUILDKIT=1
---.icon
Cloud Build 上の docker の docker info
code:cloudbuild.yaml
- name: gcr.io/cloud-builders/docker
code:output
Client:
Debug Mode: false
Server:
Containers: 4
Running: 2
Paused: 0
Stopped: 2
Images: 119
Server Version: 19.03.8
Storage Driver: overlay2
Backing Filesystem: <unknown>
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.3.0-1030-gcp
Operating System: Ubuntu 18.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.597GiB
Name: worker-05330a8c-9e14-48e1-9e19-54d6ebe5f81f
ID: 6F4B:5UUY:7PLI:7YS7:K4D3:QKIP:S7IU:BZE2:BQTZ:MVRS:XXUV:MQ3M
Docker Root Dir: /var/lib/docker
Debug Mode: true
File Descriptors: 42
Goroutines: 64
System Time: 2020-08-08T09:23:49.038694042Z
EventsListeners: 0
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
Live Restore Enabled: false
WARNING: No swap limit support
Registry Mirrors: https;//mirror.gcr.io/ が透過的に解決してくれない?
mirror だが見つからなかった時に registry に fallback してない
DOKCER_BUILDKIT=1 じゃないときはしてると思うんだけどなあ
これでなおってる?
そのうち Cloud Build のも更新されてなおるのかな
先に依存している image を pull しておく
使っている FROM ... のやつ全部
うまくいくし BuildKit 使える
例えば
code:cloudbuild.pull.yaml
- name: gcr.io/cloud-builders/docker
- name: gcr.io/cloud-builders/docker
DOCKER_BUILDKIT=1 下でも pull はできるじゃん
build 時に pull する時だけうまく行かないのか...
良い
mirror.gcr.io が解決できるもの
FROM alpine
FROM alpine:latest
FROM alpine:3
FROM alpine:3.11
だめ
FROM alpine:3.12
FROM alpine:3.12.0
FROM alpine:20200626
なんの差?
$ gcloud container images list --repository=mirror.gcr.io/library
ほうほう
$ gcloud container images list-tags mirror.gcr.io/library/alpine
code:list
DIGEST TAGS TIMESTAMP
a15790640a66 3,latest 2020-05-30T06:19:46
39eda93d1586 3.11 2020-04-24T10:05:04
e4355b66995c 3.10.3 2019-10-22T02:21:42
36c3a913e62f 3.6 2019-03-08T07:20:01
92251458088c 3.7 2019-03-08T07:19:53
0325f4ff0aa8 3.4 2019-01-31T07:20:31
ここにあるならいけるのか? 3.11 やってみよう
いける〜〜
mirror 更新しろや、latest が latest じゃねえ
ミラーをいい感じに設定する
なんかすぐ出てくるのは dockerd の設定や起動オプションなんだよな
build 実行時に無効にしたり追加したりしたい
$ docker pull gcr.io/cloud-builders/git:latest みたいな pull はできるのね
うーん
あんま手なさそう
code:log
#2 transferring context: 2B 0.0s done #1 transferring dockerfile: 154B 0.0s done #3 internal load metadata for docker.io/library/alpine:3.12.0 #3 ERROR: docker.io/library/alpine:3.12.0 not found #5 transferring context: 70B done #7 1/3 FROM docker.io/library/alpine:3.12.0 #7 resolve docker.io/library/alpine:3.12.0 0.0s done #7 ERROR: docker.io/library/alpine:3.12.0 not found ------
internal load metadata for docker.io/library/alpine:3.12.0: ------
------
1/3 FROM docker.io/library/alpine:3.12.0: ------
failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: docker.io/library/alpine:3.12.0 not found