burk
burk

Reputation: 355

Should docker --cache-from lead to multiple sha-hashes being downloaded?

I'm struggling to get the docker --cache-from to work from a remote repository. I know there are many quirks, and have among other things enabled --build-arg BUILDKIT_INLINE_CACHE=1, when building the image before pushing.

When using --cache-from I got the following output:

#14 importing cache manifest from eu.gcr.io/repo/image:tag1
#14 sha256:aa73a6a76a7a7a67a6a76a76b7a6b7a6b7a6b7a
#14 DONE 2.0s

If there are multiple layers in the image, should there be multiple sha256-hashes here?

Upvotes: 0

Views: 330

Answers (1)

BMitch
BMitch

Reputation: 263866

Buildkit should only download a layer if it needs it. If the layer is not used in the resulting image, it doesn't need to be downloaded. And if the layer is used but isn't needed locally because there's no uncached RUN step that depends on it, then it may be possible for buildkit to skip the download.

Also, keep in mind there's multiple things a sha256 digest can point to. At a minimum, there are image manifests, manifest lists, image configs (json blobs), and image layers (compressed tar blobs). You may also see different digests when layers are uncompressed. So with the above, you can assume it pulls something with that digest, most likely a manifest, and not any layers at all until/if they are needed later.

Upvotes: 1

Related Questions