Asterisk, and other worldly endeavours.

A blog by Leif Madsen

Posts Tagged ‘proxy

Docker container results in x509: failed to load system roots and no roots provided

We have a small system running in AWS as a CentOS 7 image. It has a few containers that we’re using to host a few Golang API proxies. We migrated a customers API proxy that was running on the local VM into a container, and spun it up. Upon testing, we ran into the following error:

x509: failed to load system roots and no roots provided

We get that failure when trying to connect to an HTTPS endpoint (remote API that we’re proxying to Asterisk).

Figured it had to do with the fact we were using a scratch disk to build the container image, and that there were no certs loaded. Did some Googling and found some people with similar problems, but their solutions didn’t work for us on our CentOS 7 host system.

Then I thought maybe there was some issue with following a symlink as the source since we were loading in the ca-bundle.crt file as a volume. I didn’t test enough to determine if that was the issue (it probably wasn’t), but this post gave me a hint:

So we did the following:

docker run -d -p 8085:8085 -v /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:/etc/ssl/certs/ca-certificates.crt [etc...]

After linking that file and mounting it in the container, all was well. I suspect it’s the path to the ca-certificates.crt that was the real trick.

Written by Leif Madsen

2015/10/30 at 3:30 pm

Posted in Asterisk, DevOps, Docker

Tagged with , , , , ,