`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.
More on TLS and certificate errors
`curl: (60) SSL certificate problem: certificate has expired`Beginner`curl: (60) SSL certificate problem: unable to get local issuer certificate`Beginner`SSL: no alternative certificate subject name matches target host name 'api.example.com'`BeginnerSome clients get the wrong certificate (another site's) from a shared IP.Intermediate`SSL routines::sslv3 alert handshake failure` from `openssl` or curl.IntermediatePython `requests` fails with `SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain`.Beginner