为Docker镜像加入可信任证书

在使用容器访问一个自签名证书站点的时候碰到如下报错:
image.png

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

解决方法:将该证书加到Docker镜像中,让系统信任这类证书
我使用的是基于alpine的镜像,Dockerfile如下

FROM ruby:2.6.3-alpine3.10

RUN apk update \
    && apk add --no-cache curl ca-certificates bash

RUN mkdir -p /usr/local/share/ca-certificates/
COPY ["SelfSignedRootCA.crt","/usr/local/share/ca-certificates"]

RUN ["/bin/bash","-lc","update-ca-certificates"]

build镜像过程中看到如下提醒,可以

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值