Open ibotty opened 1 year ago
I am not entirely sure but I think the layer digest changes when they are uncompressed, so parent layer is still there but the digest has changed. cc @mtrmac for info.
Yes, this is expected.
The layer digests in skopeo inspect
report the specific representation of the layers. This can be confirmed e.g. by using skopeo inspect --raw --config
, looking at rootfs.diffids
, if the image format in question contains that field, or probably much more conveniently using Podman’s tools like podman image tree
(which, OTOH can’t directly report about on-registry images).
(I would also mildly suggest that it’s not very clear to me why comparing the layer digests is useful to end users; e.g. the digests couldn’t possibly match when build --squash
is used. What are you ultimately trying to do?)
How am I supposed to check whether the base image is up to date? All documentation I can find will compare the layers.
BTW: It also kills deduplication, when I already have the base image and try to pull the image it pulls every image layer.
BTW: It also kills deduplication, when I already have the base image and try to pull the image it pulls every image layer.
That might be unexpected — but if the two are differently compressed, each computer must pull the two versions at least once to build a metadata database to know that they match. (And that can be determined using skopeo inspect
of the two on-registry images.)
I don't quiet understand. If it can be determined using skopeo inspect
it should not be neccessary to pull them twice, because afaik skopeo inspect
only downloads metadata.
Is it a given, that it's happening because of different compression? But coming back to the question, how can I determine if the base layer has been updated?
How am I supposed to check whether the base image is up to date?
that really rather depends on what assumptions can be made. As mentioned above, --squash
would break the layer digest checks. The org.opencontainers.image.base.*
annotations are another way, if you trust the image producer, and the image is using the OCI format.
WRT depuplication, please provide a complete reproducer, with debug logs of pulling the two images in sequence (podman --log-level=debug pull…
), and if the two images aren’t public, all layer information from full outputs of skopeo inspect -n
and skopeo inspect --raw --config
.
That squashing will kill the information is clear. Is there some documentation regarding the org.opencontainers.image.base.*
annotations?
WRT depuplication, please provide a complete reproducer, with debug logs of pulling the two images in sequence (
podman --log-level=debug pull…
), and if the two images aren’t public, all layer information from full outputs ofskopeo inspect -n
andskopeo inspect --raw --config
.
I did (using registry.access.redhat.com/ubi9-minimal
and quay.io/ibotty/s2i-deno
) and if I read the log correctly, you are right, it does not seem to download the layer twice.
I am still not sure how to check if the base image is up-to-date. It seems podman and buildah do not set the org.opencontainers.image.base
annotations by default. Can it be instructed to do so?
Is is a common way to check for base image layers by comparing the layer images, see e.g. the github action https://github.com/twiddler/is-my-docker-parent-image-out-of-date, but there are others that use the same approach.
Is this approach fundamentally flawed?
I'd like to use the opencontainers annotations, but I could not find a tool that would show them. Can this maybe be integrated in skopeo
?
A friendly reminder that this issue had no activity for 30 days.
@mtrmac @vrothberg Could you answer @ibotty questions?
I'd like to use the opencontainers annotations, but I could not find a tool that would show them. Can this maybe be integrated in skopeo?
Both Podman and Buildah set the annotation, see below example:
~ $ podman build -f /tmp/Dockerfile
STEP 1/2: FROM ubi9
Resolved "ubi9" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull registry.access.redhat.com/ubi9:latest...
Getting image source signatures
Checking if image destination supports signatures
Copying blob 72d37ae8760a done
Copying config 8e9c11168e done
Writing manifest to image destination
Storing signatures
STEP 2/2: RUN echo "Issue #17722" > /issue
COMMIT
--> e662dd1af7ee
e662dd1af7eec0f131749b2670dd45bad763163541f98c1da2471605a6455490
~ $ podman image inspect e662|grep "org.opencontainers.image.base"
"org.opencontainers.image.base.digest": "sha256:0bda22a725bb25c05b201ec250967a53fc4f3c6a7c82fcb2d8f6d3da3bed63dd",
"org.opencontainers.image.base.name": "registry.access.redhat.com/ubi9:latest"
You can inspect the annotations via skopeo inspect --raw
as shown below:
~ $ skopeo inspect --raw containers-storage:e66 | jq .
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": {
"mediaType": "application/vnd.oci.image.config.v1+json",
"digest": "sha256:e662dd1af7eec0f131749b2670dd45bad763163541f98c1da2471605a6455490",
"size": 6679
},
"layers": [
{
"mediaType": "application/vnd.oci.image.layer.v1.tar",
"digest": "sha256:11939111cd6623e79e2b583306543b67986f0fb22b0c051ac16f563a2f7672c2",
"size": 219357696
},
{
"mediaType": "application/vnd.oci.image.layer.v1.tar",
"digest": "sha256:26a5a55a3a48d7b565f50013d012eefd611cb42bd0017fc9853135b3e92c99a9",
"size": 4096
}
],
"annotations": {
"org.opencontainers.image.base.digest": "sha256:0bda22a725bb25c05b201ec250967a53fc4f3c6a7c82fcb2d8f6d3da3bed63dd",
"org.opencontainers.image.base.name": "registry.access.redhat.com/ubi9:latest"
}
}
With that information, you can use the base.name
and compare the base.digest
to the current digest on the registry. If they, differ then the image on the registry is newer. Be careful when comparing digests to always compare the digests of the specific image. For instance, to compare the digests of the linux/amd64 images.
Issue Description
Creating an image with base image
registry.access.redhat.com/ubi9
does not use the parent image's layers sha256 digest.Steps to reproduce the issue
Steps to reproduce the issue
Describe the results you received
With
I get
Describe the results you expected
With
podman info output