How do I add a CA root certificate inside a docker image?

前端 未结 4 863
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 03:58

I am running an ASP.NET Core 1.1 Web API in a Docker 1.13.1 container on Ubuntu 14.04.

When the code attempts to retrieve some data from an HTTPS server, I get this

4条回答
  •  不知归路
    2020-11-29 04:41

    The task itself is not specific to docker as you would need to add that CA on a normal system too. There is an answer on the askubuntu community on how to do this.

    So in a Dockerfile you would do the following (don't forget chmod in case you're running the container with a user other than root):

    ADD your_ca_root.crt /usr/local/share/ca-certificates/foo.crt
    RUN chmod 644 /usr/local/share/ca-certificates/foo.crt && update-ca-certificates
    

提交回复
热议问题