Closed Romain-Geissler-1A closed 8 months ago
Note that actually only after I finished writing this investigation I have found this issue which seems to deal with some similar concerns: https://github.com/containers/podman/issues/20611 So maybe my issue is just a duplicate of this known issue.
@giuseppe PTAL
I'll give it a try but this should be fixed with: https://github.com/containers/image/pull/1980
Ok thanks. As soon as this is vendored into podman and released into a quay.io/podman/upstream image, I can test as well the full flow on my side, with pushing to a registry and re-pulling back on docker side.
Note that in another scenario where I would like to adopt zstd:chunked, I would like to build images via buildx (connecting to a real docker daemon, as this is the only thing I have in Jenkins environment for now), export it to an oci-archive via buildx, then push it to a registry and re-compressing it on the fly to zstd:chunked via skopeo. And so far my attempt to create zstd:chunked image this way via skopeo instead of podman failed similarly, so I hope your fix will apply to skopeo too ;)
it seems still broken with the current version, taking a look now
opened a PR: https://github.com/containers/storage/pull/1772
Issue Description
It seems that --compression-format=zstd:chunked generates invalid OCI images. When pushed in a registry, and then pull by docker, docker complains with "layers from manifest don't match image configuration".
Steps to reproduce the issue
Here is how to reproduce using the very latest podman upstream image:
Pull a fedora image
Now export this image in 3 different compression format on disk:
Now let's compare the digest of the "config" artefact of each docker OCI image. We use jq to do a bit of indirection and read the right blob file. The digest is the same for all 3 OCI images, as expected. At the end, we show the rootfs of this config file (from the gzip image since it's the same on all images):
[root@2cc5686c4046 /]# jq ".rootfs" "image.gzip/blobs/$(jq -r ".config.digest" "image.gzip/blobs/$(jq -r ".manifests[0].digest" image.gzip/index.json | tr : /)" | tr : /)" { "type": "layers", "diff_ids": [ "sha256:8ff7ad910417a7b8a49019008335921d2aac0e3304a19ce258deabf431e59801" ] }
[root@2cc5686c4046 /]# zcat "image.gzip/blobs/$(jq -r ".layers[0].digest" "image.gzip/blobs/$(jq -r ".manifests[0].digest" image.gzip/index.json | tr : /)" | tr : /)" | file - /dev/stdin: POSIX tar archive (GNU) [root@2cc5686c4046 /]# zcat "image.gzip/blobs/$(jq -r ".layers[0].digest" "image.gzip/blobs/$(jq -r ".manifests[0].digest" image.gzip/index.json | tr : /)" | tr : /)" | sha256sum 8ff7ad910417a7b8a49019008335921d2aac0e3304a19ce258deabf431e59801 - [root@2cc5686c4046 /]# [root@2cc5686c4046 /]# zstdcat "image.zstd/blobs/$(jq -r ".layers[0].digest" "image.zstd/blobs/$(jq -r ".manifests[0].digest" image.zstd/index.json | tr : /)" | tr : /)" | file - /dev/stdin: POSIX tar archive (GNU) [root@2cc5686c4046 /]# zstdcat "image.zstd/blobs/$(jq -r ".layers[0].digest" "image.zstd/blobs/$(jq -r ".manifests[0].digest" image.zstd/index.json | tr : /)" | tr : /)" | sha256sum 8ff7ad910417a7b8a49019008335921d2aac0e3304a19ce258deabf431e59801 - [root@2cc5686c4046 /]# zstdcat "image.zstd-chunked/blobs/$(jq -r ".layers[0].digest" "image.zstd-chunked/blobs/$(jq -r ".manifests[0].digest" image.zstd-chunked/index.json | tr : /)" | tr : /)" | file - /dev/stdin: POSIX tar archive (GNU) [root@2cc5686c4046 /]# zstdcat "image.zstd-chunked/blobs/$(jq -r ".layers[0].digest" "image.zstd-chunked/blobs/$(jq -r ".manifests[0].digest" image.zstd-chunked/index.json | tr : /)" | tr : /)" | sha256sum 57b0ecf19f5d86d4002f7998b1f336f026d2c6301f74463234a76712d8d753a2 -
[root@2cc5686c4046 /]# diff -u <(zstdcat "image.zstd/blobs/$(jq -r ".layers[0].digest" "image.zstd/blobs/$(jq -r ".manifests[0].digest" image.zstd/index.json | tr : /)" | tr : /)" | tar -v -t) <(zstdcat "image.zstd-chunked/blobs/$(jq -r ".layers[0].digest" "image.zstd-chunked/blobs/$(jq -r ".manifests[0].digest" image.zstd-chunked/index.json | tr : /)" | tr : /)" | tar -v -t)
[root@2cc5686c4046 /]# tar-split disasm --output tar-data.zstd.json.gz <(zstdcat "image.zstd/blobs/$(jq -r ".layers[0].digest" "image.zstd/blobs/$(jq -r ".manifests[0].digest" image.zstd/index.json | tr : /)" | tr : /)") | sha256sum INFO[0000] created tar-data.zstd.json.gz from /dev/fd/63 (read 182886400 bytes) 8ff7ad910417a7b8a49019008335921d2aac0e3304a19ce258deabf431e59801 - [root@2cc5686c4046 /]# tar-split disasm --output tar-data.zstd-chunked.json.gz <(zstdcat "image.zstd-chunked/blobs/$(jq -r ".layers[0].digest" "image.zstd-chunked/blobs/$(jq -r ".manifests[0].digest" image.zstd-chunked/index.json | tr : /)" | tr : /)") | sha256sum INFO[0000] created tar-data.zstd-chunked.json.gz from /dev/fd/63 (read 182880256 bytes) 57b0ecf19f5d86d4002f7998b1f336f026d2c6301f74463234a76712d8d753a2 -
[root@2cc5686c4046 /]# diff -u <(zcat tar-data.zstd.json.gz) <(zcat tar-data.zstd-chunked.json.gz) --- /dev/fd/63 2023-12-05 23:44:13.901880393 +0000 +++ /dev/fd/62 2023-12-05 23:44:13.901880393 +0000 @@ -16803,5 +16803,4 @@ {"type":2,"payload":"Li9saWI2NAAAAAA (many AAAA ommitted) AAAAADAwMDA3NzcAMDAwMDAwMAAwMDAwMDAwA DAwMDAwMDAwMDAwADE0NDU2MzQ1MjAwADAxMjIzMAAgMnVzci9saWI2NAAAAAAAA (many AAAA ommitted) AAAAAB1c3RhciAg AHJvb3QAAAAAAAAAAA(many AAAA ommitted) AAAAAAAAAAcm9vdAAAAAAAAAA (many AAAA ommitted) AAAAAAAAAA=","position":16802} {"type":1,"name":"./lib64","payload":null,"position":16803} {"type":2,"payload":"AAAAAAAAAAAAAAAA (many AAAA ommitted) AAAAAAAAAAAAA==","position":16804} -{"type":2,"payload":"AAAAAAAAAAAA (many AAAA omitted) AAAAAAAAAAAAAAAAA","position":16805} -{"type":2,"payload":"","position":16806} +{"type":2,"payload":"","position":16805}
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
No response
Additional information
No response