fix: include CA certificates in the pack base image#2609
Open
officialasishkumar wants to merge 1 commit into
Open
fix: include CA certificates in the pack base image#2609officialasishkumar wants to merge 1 commit into
officialasishkumar wants to merge 1 commit into
Conversation
The delivery-docker workflow builds the Dockerfile twice: the tiny image
(buildpacksio/pack and :latest) from gcr.io/distroless/static, and the
base image (buildpacksio/pack:<version>-base and :base) from ubuntu:jammy.
The distroless base bundles a CA certificate store, but the ubuntu:jammy
image does not ship the ca-certificates package. As a result the -base
image has no trusted roots, and any pack command that talks to a registry
over TLS fails:
ERROR: ... Get "https://index.docker.io/v2/": tls: failed to verify
certificate: x509: certificate signed by unknown authority
Copy the CA bundle from the golang builder stage (which is Debian based
and includes ca-certificates) into the final image. This restores trusted
roots for the ubuntu:jammy -base image and is a harmless no-op for the
distroless image, which already ships the same bundle at that path, so a
single line fixes every published base image.
Verified by building the Dockerfile with both base images and performing
an HTTPS request to a registry from inside each: ubuntu:jammy fails
without the copy and succeeds with it, and the distroless image keeps
working.
Resolves buildpacks#2488
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
4b9dcb1 to
4fc4456
Compare
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
The
delivery / dockerworkflow builds theDockerfiletwice:buildpacksio/packand:latest) fromgcr.io/distroless/staticbuildpacksio/pack:<version>-baseand:base) fromubuntu:jammyThe distroless base bundles a CA certificate store, but the
ubuntu:jammyimage does not ship theca-certificatespackage. As a result the-baseimage has no trusted roots, and anypackcommand that reaches a registry over TLS fails (reported in #2488):The fix copies the CA bundle from the
golangbuilder stage (which is Debian based and includesca-certificates) into the final image. This restores trusted roots for theubuntu:jammybased-baseimage and is a no-op for the distroless image, which already ships the same bundle at that path, so a single line covers every published base image.Output
I verified this by building the
Dockerfilewith each base image and performing an HTTPS request to a registry from inside each resulting container.Before
After
The distroless
:latestimage is unaffected and keeps working.Documentation
Related
Resolves #2488