moby / buildkit

concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
https://github.com/moby/moby/issues/34227
Apache License 2.0
8.19k stars 1.16k forks source link

Feature request: support for SOCI index #5347

Open tetienne opened 1 month ago

tetienne commented 1 month ago

Follow-up of https://github.com/docker/build-push-action/issues/907

AWS have just announced a new open source feature for making docker images load faster. It would be great if support can be added for the build, and push stage of the action. 🙏

AWS Blog: https://aws.amazon.com/about-aws/whats-new/2023/07/aws-fargate-container-startup-seekable-oci/

Getting started with the SOCI snapshot tool: https://github.com/awslabs/soci-snapshotter/blob/main/docs/getting-started.md

nakamorichi commented 1 month ago

You probably mean buildctl support for generating and pushing soci indexes? There's no such thing as soci image, but you can enable support for soci by setting it as snapshotter for buildkitd:

[worker.containerd]
    snapshotter = 'soci'
        ...

And for building/pushing soci indexes, you can use nerdctl (recommended) or soci cli:

I wouldn't keep hopes up for having support for soci or any modern snapshotters drop to docker. Out-of-the-box support for buildctl would be nice, though.

nakamorichi commented 1 month ago

Btw, I'm currently building and pushing images and soci indexes this way:

# build the image without pushing
nerdctl build \
    --snapshotter=soci \
    --cache-from=type=registry,ref=<cache image> \
    --cache-to=type=registry,mode=max,ref=<cache image>,image-manifest=true,oci-mediatypes=true \
    --output=type=image,name=<app image>,push=false,oci-mediatypes=true,store=true \
    .
# push image and soci index
nerdctl push \
    --snapshotter=soci \
    --soci-span-size=2097152 \
    --soci-min-layer-size=20971520 \
    <app image>

nerdctl build apparently is based on buildctl and doesn't thus support soci, so image build and push need to be split into separate commands.