docker 内部发起 https 请求导致failed to load system roots and no roots provided

x509 failed to load system roots and no roots provided

遇到这样问题的原因是该服务用到了HTTPS协议,容器内部没有相关的运行环境,需要在打包镜像的Dockerfile中加上一句,安装ca-certificates的包,基础镜像是alpine:3.7

RUN apk update && \
    apk add ca-certificates && \
    rm -rf /var/cache/apk/*