containerd daemon: optional publish-then-pull workaround to avoid dig…#2521
Open
casibbald wants to merge 3 commits intobuildpacks:mainfrom
Open
containerd daemon: optional publish-then-pull workaround to avoid dig…#2521casibbald wants to merge 3 commits intobuildpacks:mainfrom
casibbald wants to merge 3 commits intobuildpacks:mainfrom
Conversation
2ace832 to
6ce37bc
Compare
…est errors (fixes buildpacks#2272) When not publishing and daemon uses containerd storage, publish to local registry (default localhost:5001, PACK_CONTAINERD_WORKAROUND_REGISTRY) then pull and tag so app image is not exported directly to daemon. Signed-off-by: Charles Sibbald <casibbald@gmail.com> Signed-off-by: casibbald <casibbald@gmail.com>
6ce37bc to
99ebb2c
Compare
Member
|
Hi @casibbald Thanks for this PR! I think the workaround of having a
I know it is more comfortable to have |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the Docker daemon uses containerd storage (default on Docker Desktop and Colima), exporting the built app image directly to the daemon can fail with digest errors or be severely degraded:
unable to create manifests file: NotFound: content digest sha256:...: not found(#2270, closed as known limitation).This PR adds an optional workaround when building without
--publish:docker info(driver-type=io.containerd.snapshotter.v1).localhost:5001), then pull it into the daemon and tag it as the user-requested image. The lifecycle thus pushes to the registry instead of writing to the daemon, avoiding the digest path.PACK_CONTAINERD_WORKAROUND_REGISTRY(e.g.host.docker.internal:5001if the registry runs on the host). The workaround registry is automatically added to insecure registries for the lifecycle when needed.Scope: Only applies when
opts.Publishis false. When the user passes--publish, pack already pushes to the registry and no workaround is used.Output
Before
With containerd storage and
pack build myimage(no--publish):unable to create manifests file: NotFound: content digest sha256:...: not found(see Build fails if containerd is used with an untrusted builder #2270).No automatic workaround; user had to either disable containerd, use
pack build --publishto a registry, or run a local registry and use--publishto it.After
With containerd storage and
pack build myimage(no--publish), and no layout/previous image:Daemon uses containerd storage; using publish-then-pull workaround (registry: localhost:5001). See https://github.com/buildpacks/pack/issues/2272.localhost:5001); pack then pulls it into the daemon and tags asmyimage. Build completes without writing the app image directly to the daemon.docker run -p 5001:5000 registry:2for default). Override withPACK_CONTAINERD_WORKAROUND_REGISTRY=host.docker.internal:5001if the registry runs on the host.When workaround does not apply (e.g. layout or previous image) but daemon uses containerd:
Exporting to docker daemon (building without --publish) and daemon uses containerd storage; performance may be significantly degraded. For more information, see https://github.com/buildpacks/pack/issues/2272.Documentation
Related
Resolves #2272
Related: #2270 (build failure with containerd + untrusted builder; same underlying daemon export / digest issue; closed with workaround guidance).