2. Copyright(c)2021 NTT Corp. All Rights Reserved
GitHub:@ktock / Twitter:@TokunagaKohei
Container Runtime Meetup
1/28 2
https://runtime.connpass.com/event/198071/
3. Copyright(c)2021 NTT Corp. All Rights Reserved
FROM ubuntu:20.04
RUN apt-get update &&
apt-get install –y figlet
COPY ./hello.sh /hello.sh
Dockerfile
RUN
COPY
pull
l
• 3
l
•
5. Copyright(c)2021 NTT Corp. All Rights Reserved
( )( pull )
5
pulling packages accounts for 76% of container start time,
but only 6.4% of that data is read [Harter et al. 2016]
[Harter et al. 2016] Tyler Harter, Brandon Salmon, Rose Liu, Andrea C. Arpaci-Dusseau, Remzi H. Arpaci-Dusseau. "Slacker: Fast Distribution with
Lazy Docker Containers". 14th USENIX Conference on File and Storage Technologies (FAST ’16). February 22–25, 2016, Santa Clara, CA, USA
7. Copyright(c)2021 NTT Corp. All Rights Reserved
BuildKit
l
l --mount
l LLB7
l
l Kubernetes
l
docker build
l Docker 18.09 Docker
l Linux Docker DOCKER_BUILDKIT=1 Docker Buildx7
l Docker Desktop 2.4
https://github.com/moby/buildkit
8. Copyright(c)2021 NTT Corp. All Rights Reserved
BuildKit Lazy Pull ”pull ”
FROM ghcr.io/stargz-containers/golang:1.15.3-esgz as dev
COPY ./hello.go /hello.go
RUN go build -o hello /hello.go
lazy
pull
• /usr/local/go/bin/go
• /usr/local/go/src/fmt/…
etc...
Pull COPY RUN
golang:1.15.3-esgz pull
eStargz
l BuildKit v0.8.0 eStargz lazy pulling experimental
l pull
• eStargz BuildKit lazy pull
• → FROM pull COPY RUN pull
l 8
https://medium.com/nttlabs/buildkit-lazypull-66c37690963f
10. Copyright(c)2021 NTT Corp. All Rights Reserved
eStargz
tar.gz
HTTP Range Request 1
/ pull
bin/ls
etc/group
usr/bin/apt
/ gzip
tar.gz
1
eStargz
bin/ls
usr/bin/apt
entrypoint.sh
bin/bash Range Request
0
bin/bash
entrypoint.sh
TOCEntries footer
l gzip OCI
• → lazy pull 1
l 1
• Google CRFS https://github.com/google/crfs 0 stargz
• 0
l 0
Ø NW
11. Copyright(c)2021 NTT Corp. All Rights Reserved
eStargz
l Docker 1 eStargz
l Kaniko nerdctl ko 1 eStargz
l eStargz
snapshotter prefetch
•
1
•
proc eStargz
12. Copyright(c)2021 NTT Corp. All Rights Reserved
Hello World
l Hello World 12
• 3
• gcc:10.2.0
• golang:1.15.3-buster
• python:3.9.0-buster
• Dockerfile: https://github.com/ktock/stargz-snapshotter/tree/bbbmeasure/script/buildkit/measure/sample
• 3
l GitHub Actions Ubuntu runner (eastus2)
l GitHub Container Registry
FROM ghcr.io/stargz-containers/golang:1.15.3-buster-esgz AS dev
COPY ./main.go /go/src/
RUN cd /go/src && go build -o hello ./main.go
FROM ghcr.io/stargz-containers/alpine:3.10.2-esgz
COPY --from=dev /go/src/hello /hello
ENTRYPOINT [ "/hello" ]
Dockerfile golang:1.15.3
13. Copyright(c)2021 NTT Corp. All Rights Reserved
Hello World ( export )
golang-1.15.3-bustergcc-10.2.0 python-3.9.0-buster
eStargz 3
eStargz 3
1
14. Copyright(c)2021 NTT Corp. All Rights Reserved
Buildx Lazy Pull BuildKit
DEMO
https://medium.com/nttlabs/buildkit-lazypull-66c37690963f
15. Copyright(c)2021 NTT Corp. All Rights Reserved
l lazy pulling
• https://github.com/moby/buildkit/pull/1733
l export lazy 1
• pull
• Cross-repo mount 5
push lazy
5
l rootless
experimental
17. Copyright(c)2021 NTT Corp. All Rights Reserved
( )Cross-repo mount pull/push ( )
BuildKit
Lazy pull
Cross-repo mount
push
l 1 cross-repo mount
pull/push
• 1push
push 1mount push 1
• lazy1 7
pull
push
18. Copyright(c)2021 NTT Corp. All Rights Reserved
l cross-repo mount rootless
l
• Bugfix 8
l
•
l etc…
Lazy pulling Stargz Snapshotter
l eStargz OCI on-going OCI
• https://github.com/opencontainers/image-spec/issues/815
l eStargz 1
• Kaniko Google GGCR_EXPERIMENT_ESTARGZ=1
• https://github.com/GoogleContainerTools/kaniko
• nerdctl containerd Docker CLI by NTT
• https://github.com/AkihiroSuda/nerdctl
eStargz Stargz Snapshotter
19. Copyright(c)2021 NTT Corp. All Rights Reserved
l 9
• Pull
• Temporary fresh1 pull
l BuildKit v0.8.0 9eStargz lazy pulling
• CI 1 1
1
• eStargz lazy pulling 1 +
• containerd Stargz Snapshotter lazy pulling
• containerd Kubernetes lazy pulling
l
• Stargz Snapshotter eStargz
Feedbacks and suggestions are always welcome!
https://github.com/containerd/stargz-snapshotter