Interview Prep/Networking/TLS and certificate errors

`x509: certificate signed by unknown authority` from a Go binary in a scratch/distroless image.

BeginnerTroubleshootingTLS and certificate errors
Answer

Likely causes → The image has no CA bundle at /etc/ssl/certs/ca-certificates.crt.

Diagnose →

docker run --rm --entrypoint ls myimage /etc/ssl/certs    # fails or empty in scratch

Fix → Copy the bundle in a multi-stage build:

COPY --from=alpine:3.20 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

or use gcr.io/distroless/static, which includes CA certificates.

Prevent → Use base images with CA bundles and test outbound HTTPS in CI.

All Networking questions Roadmap: Networking for DevOps

More on TLS and certificate errors