Add Custom CA SSL Certificates to Docker-Images

If you have a custom CA and want your docker images to trust you certificates, you have to include the ca-certs in you images. This is different depending on the distribution of the base-image.

Debian Based

For Debian add these lines to your Dockerfile and provide the expected files.

FROM debian

ADD certs/my-cert.cer /usr/local/share/ca-certificates/my-cert.crt
RUN chmod 644 /usr/local/share/ca-certificates/*
RUN update-ca-certificates


It is important that your cert needs to have the filetype .crt. Otherwise it will not be added.

profile picture of the author

Jannik Rehkemper

I'm an professional Linux Administrator and Hobby Programmer. My training as an IT-Professional started in 2019 and ended in 2022. Since 2023 I'm working as an Linux Administrator.