0

(我在找到解决方案后添加了这个问题,因为当我需要它时,我的错误没有匹配。)

将 rust 应用程序打包为 docker 容器后,出现以下错误:Hyper error: invalid certificate: UnknownIssuer.

我使用了官方 rust docker 镜像中的示例(参见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"]
4

1 回答 1

1

问题是 debian docker 映像不包含该ca-certificate软件包。该问题已通过以下方式解决:

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"]
于 2020-06-29T18:27:12.257 回答