Vaughan Reid's blog

Docker with certificates

Sometimes when connecting to internal systems you need trusted certificates to be able to authenticate. Generally the base docker image you use when running ASP.NET core applications would not have your internal company certificates. You need a way to deploy these in your container so that your endpoints work.

One way that you could do it is to copy all the certificates that you need to a Certificates folder and add the following in your docker build:


COPY ./certificates/*.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates

This updates the debian certificate authority with your local certificates.

One thing that could become an issue is that you might need to have all your env certificates in that same folder. A nicer way to do this in a Kubernetes environment would be to save your certificates as a secret in each environment and then mount them into the certificates folder when you load the image.