Well I was facing a similar issue. And here is it, where I was:
My Scenario:
Built an Ubuntu VM on Oracle VB, and started building my K8s cluster. The docker fails to pull the calico images. Throwing out below errors:
Failed to pull image "docker.io/calico/cni:v3.18.2": rpc error [...]
INFO[0009] Get https://registry-1.docker.io/v2: x509: certificate
signed by unknown authority.
Then I tried to perform a simple 'docker login' to the default registry, which lead me to the same error.
These were the outcomes learnt from, an entire day, reading and learning:
- you can use a self signed certificate
- you can get a CA certificate from the official website
TBH, none of the above lessons lead me to eureka!
So, here is what I did:
I downloaded the certificate from the actual registry, and added it to /etc/docker/certs/[registry_domain_name]
and the appended the same to the SSL CA certificate on the server. And guess what, I did give me results. So here are the steps in detail below:
Step 1: openssl s_client -showcerts -connect ${DOMAIN}:${PORT}</dev/null2>/dev/null|openssl x509 -outform PEM >ca.crt
What I Ran: openssl s_client -showcerts -connect registry-1.docker.io:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >ca.crt
Step 2: sudo cp ca.crt /etc/docker/certs.d/${DOMAIN}/ca.crt
What I Ran: sudo cp ca.crt /etc/docker/certs.d/registry-1.docker.io/ca.crt
Step 3: cat ca.crt | sudo tee -a /etc/ssl/certs/ca-certificates.crt
Step 4: sudo service docker restart
Credits to the blog: https://rancher.com/docs/rancher/v1.6/en/environments/registries/