Reputation: 1456
(I am adding this question after finding the solution as there was no matches for my error when I needed it.)
After packaging a rust app as a docker container, I get the following error: Hyper error: invalid certificate: UnknownIssuer
.
I have used the example from the official rust docker image (cf. https://hub.docker.com/_/rust/):
FROM rust:1.40 as builder
WORKDIR /usr/src/myapp
COPY . .
RUN cargo install --path .
FROM debian:buster-slim
RUN apt-get update && apt-get install
COPY --from=builder /usr/local/cargo/bin/myapp /usr/local/bin/myapp
CMD ["myapp"]
Upvotes: 5
Views: 3479
Reputation: 553
I got this error in a Node environment.
For me the answer was to not use the "slim" version:
# Change
FROM node:20-slim AS base
# To
FROM node:20 AS base
Upvotes: 0
Reputation: 1456
The issue was that the debian docker image does not include the ca-certificate
package. The issue was solved using:
FROM rust:1.40 as builder
WORKDIR /usr/src/myapp
COPY . .
RUN cargo install --path .
FROM debian:buster-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
COPY --from=builder /usr/local/cargo/bin/myapp /usr/local/bin/myapp
CMD ["myapp"]
Upvotes: 4