nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

Create SOCI Indexes when pushing multiple platforms

Open ollypom opened this issue 2 years ago • 1 comments

What is the problem you're trying to solve

A SOCI index is tied to a container image manifest not a manifest list / image index. In https://github.com/containerd/nerdctl/pull/2467 we added support to generate a SOCI Index on push with nerdctl push --snapshotter soci however today this fails if you attempt to push multiple platforms at the same time.

Current behavior today:

$ nerdctl image ls
REPOSITORY                                                 TAG       IMAGE ID        CREATED           PLATFORM       SIZE         BLOB SIZE
111222333444.dkr.ecr.eu-west-1.amazonaws.com/nginx-demo    latest    cd6043ce93a0    9 minutes ago     linux/arm64    670.5 MiB    235.1 MiB
111222333444.dkr.ecr.eu-west-1.amazonaws.com/nginx-demo    latest    cd6043ce93a0    9 minutes ago     linux/amd64    0.0 B        241.6 MiB

With the --all-platforms flag results in a confusing "true" not found error.

$ nerdctl push --snapshotter soci --all-platforms 111222333444.dkr.ecr.eu-west-1.amazonaws.com/nginx-demo
index-latest@sha256:cd6043ce93a09b7ab1086837945401dbd63ad78da23c50fd2128ce8e80aaf5a1: done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:efbf016ba665281867463004baa20cd764f049fb520d1d1d2dcdeb5c01bfb386:     done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:bdae03687df2d8f4ecbfef44a51228064c012cc20a29eaf315a1d5ee38fb6716:     done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:d3e6c5969420b426f5a909b2520fe2699c385ef3011f99b3e297a73c7c30c03e:       done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:8207b6dd7ee1e3b31d05b519da6affa53c28e031e636dc1f490476c734f3edaf:       done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 1.4 s                                                                        total:  5.0 Ki (3.6 KiB/s)
INFO[0001] soci: soci: image "true": not found         

When specifying specific platforms the regex fails because of the comma.

$ nerdctl push --snapshotter soci --platform=amd64,arm64 111222333444.dkr.ecr.eu-west-1.amazonaws.com/nginx-demo
INFO[0000] pushing as a reduced-platform image (application/vnd.oci.image.index.v1+json, sha256:cd6043ce93a09b7ab1086837945401dbd63ad78da23c50fd2128ce8e80aaf5a1)
index-latest@sha256:cd6043ce93a09b7ab1086837945401dbd63ad78da23c50fd2128ce8e80aaf5a1: done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:efbf016ba665281867463004baa20cd764f049fb520d1d1d2dcdeb5c01bfb386:     done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:bdae03687df2d8f4ecbfef44a51228064c012cc20a29eaf315a1d5ee38fb6716:     done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:8207b6dd7ee1e3b31d05b519da6affa53c28e031e636dc1f490476c734f3edaf:       done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:d3e6c5969420b426f5a909b2520fe2699c385ef3011f99b3e297a73c7c30c03e:       done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 1.4 s                                                                        total:  5.0 Ki (3.6 KiB/s)
INFO[0001] soci: soci: could not parse platform amd64,arm64: "amd64,arm64" is an invalid component of "amd64,arm64": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument                           

Describe the solution you'd like

A SOCI Index for each platform is created and pushed.

Additional context

No response

ollypom avatar Nov 16 '23 14:11 ollypom

I am able to reproduce this at my end. Investigating the root cause.

monirul avatar Feb 06 '24 00:02 monirul