My docker get error "x509 certificate signed by unknown authority" and then i find that my ubuntu contianer missing file ca-certificates.crt on /etc/ssl/certs/ or /usr/local/share/certificates/. The solution of this error is add ca-certificates.crt to the */usr/local/share/certificates/** folder and run update-ca-certificates command. But my problem is I dont know where to get that .crt file.

2 Answers 2


This is how I fix that:

docker run -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt --name test image

I create a bind volume from file ca-certificates.crt on the docker host(Centos) to the container and let container use it for verify trusted ca.

  • In fact you just need to create and copy /etc/ssl/certs/ca-certificates.crt in the docker container. No need to mount the entire directory
    – jwong
    Aug 14, 2022 at 22:51

To get certificates, run similar to the next command:

openssl req -newkey rsa:2048 -nodes -keyout nginx/my-site.com.key -x509 -days 365 -out nginx/my-site.com.crt

Also, you could use these instructions:

PASS=$(openssl rand -hex 16)

# remove certificates from previous execution.
rm -f *.pem *.srl *.csr *.cnf

# generate CA private and public keys
echo 01 > ca.srl
openssl genrsa -des3 -out ca-key.pem -passout pass:$PASS 2048
openssl req -subj '/CN=*/' -new -x509 -days $DAYS -passin pass:$PASS -key ca-key.pem -out ca.pem

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .