Minimal Rust HTTPS client to reproduce the common missing CA certificates problem in scratch-based Docker images.
This project contains:
- broken.Dockerfile → Multi-stage build without CA certificates (HTTPS requests fail).
- Dockerfile → Multi-stage build with CA certificates (HTTPS requests succeed).
- Makefile → Helper commands to build and run both versions quickly.
- The Rust application uses
reqwestwithrustls-tls-native-roots, which relies on the system's certificate store. - In a
scratchimage,/etc/ssl/certsis missing by default, causing HTTPS requests to fail. - Adding the
ca-certificatesfile fixes the problem.
make build-broken
make run-brokenExpected output: A certificate verification error due to missing root CAs.
make build
make runExpected output: Status: 200 OK with the number of bytes from the response body.