2

(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"]
yngling
  • 1,376
  • 2
  • 22
  • 34

1 Answers1

2

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"]
yngling
  • 1,376
  • 2
  • 22
  • 34