Rebuild fails with "failed to load system roots and no roots provided"

AI-generated summary

Rebuild fails with “failed to load system roots and no roots provided”

A rebuild attempt of a Discourse forum failed due to a Docker installation issue. The error message “x509: failed to load system roots and no roots provided” suggests a problem with root CA certificates. mpalmer noted that this error typically occurs when root CA certificates are not installed, causing HTTPS to malfunction. After investigation, Matthieu confirmed that the issue was indeed caused by a missing file /etc/pki/tls/certs/ca-bundle.crt. This file is likely part of the ca-certificates package, which can be installed to resolve the problem.

While trying to update our discourse forum I bumped on this problem:

When running these command lines:

mlapeyre@poppy-project discourse]$ cd /var/discourse
[mlapeyre@poppy-project discourse]$ git pull
error: cannot open .git/FETCH_HEAD: Permission denied

[mlapeyre@poppy-project discourse]$ sudo git pull
Already up-to-date.
[mlapeyre@poppy-project discourse]$ sudo ./launcher rebuild app
which: no docker.io in (/usr/bin:/bin:/usr/sbin:/sbin)

WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed

Please be patient

Unable to find image 'discourse/discourse:1.0.15' locally
Pulling repository discourse/discourse
Get https://index.docker.io/v1/repositories/discourse/discourse/images: x509: failed to load system roots and no roots provided
Your Docker installation is not working correctly

See: https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam
[mlapeyre@poppy-project discourse]$ 

Any idea what could solve the problem ?

What version of docker are you running? Can you try updating to 1.9?

That strongly suggests you don’t have any root CA certificates installed in the machine which you are running Docker on. Without those, HTTPS doesn’t work, because it doesn’t know if the certificates being presented by websites are legit.

Given your prompt style, I’m thinking you’re probably running a RHEL-alike distro, so the package you want to install is probably ca-certificates.

Indeed the problem was a missing file /etc/pki/tls/certs/ca-bundle.crt