containerd / stargz-snapshotter

Fast container image distribution plugin with lazy pulling
https://github.com/containerd/containerd/issues/3731
Apache License 2.0
1.12k stars 114 forks source link

Pulling -esgz images is slower than -org images using docker buildx #1681

Closed signed-long closed 3 months ago

signed-long commented 3 months ago

I'm trying to set up a test of pulling pre-converted images with and without lazy-pulling/using the stargz snapshotter.

Doing this in a gha workflow, see the commands run here: https://github.com/signed-long/gha-labs/blob/cd9fb446960c2e2ef812208ca65ec1ab5bac46e5/.github/workflows/stargz-test.yaml#L68

And the logs here: https://github.com/signed-long/gha-labs/actions/runs/9120963253/job/25079331611

The esgz image builds slower than the original image. Is doing these install steps necessary, or just docker buildx create --use --name lazy-builder --buildkitd-flags '--oci-worker-snapshotter=stargz'? The logs do say:

#0 building with "lazy-builder" instance using docker-container driver

Any help with setting up this test is appreciated!

ktock commented 3 months ago
docker buildx build --load -t hello-esgz -f Dockerfile.stargz_esgz .

Why does the result image need to load to Docker? This causes downloading of the result image (including lazy base image) to the node so that they can be sent to Docker. Instead, should this be pushed to the registry? This can prevent downloading layers to the node with reusing existing layers on the registry.

signed-long commented 3 months ago

My end goal is to run some tests inside the container with docker run.

ktock commented 3 months ago

In that case, you also need to enable stargz-snapshotter on Docker as well : https://github.com/containerd/stargz-snapshotter/blob/201c672a8265b3e623f14b1e29868e6c25778def/docs/INSTALL.md#install-stargz-snapshotter-for-dockermoby-with-systemd

ktock commented 3 months ago

--load will still cause downloading of the entire image so you might want to pass the image from builder to the runtime via the registry.

signed-long commented 3 months ago

Thank you for the help, I now see this error when following the install steps from systemctl restart containerd:

https://github.com/signed-long/gha-labs/actions/runs/9122641818/job/25083746461#step:4:865

ktock commented 3 months ago

What error log does containerd process provide?

signed-long commented 3 months ago

here is the containerd log: https://github.com/signed-long/gha-labs/actions/runs/9135332218/job/25122494490#step:5:7

ktock commented 3 months ago

https://github.com/signed-long/gha-labs/actions/runs/9135332218/job/25122494490#step:5:128

Looks like a configuration error happens in the config file. Could you check the contains? The error reports about cri configuration error that looks like unrelated to Docker + lazy pulling configuration.

signed-long commented 3 months ago

Got it, removed the disabled_plugins = ["cri"] from the Runner's /etc/containerd/config.toml file and the containerd service restated successfully.

Can now see running the container directly from the registry is faster with esgz image: stargz-test

Thanks for the assistance @ktock