Wondering how to fix Docker Error x509? We can help you.
Often our customers using Docker report to us that they get this error while trying to log into their docker registry.
Here at Bobcares, we often handle requests from our customers to fix similar errors as a part of our Server Management Services.
Today we will see how our Support Engineers fix this for our customers.
How to fix Docker Error x509
Before going into the steps for fixing this error we will see what causes this error.
When we try to login into the Docker registry in the following way:
docker login example.com:5555 -u admin -p Passw0rd
We may at times end up with the following error:
Get https://example.com:5555/v2/: x509: certificate signed by unknown authority
This happens when we are using a self-signed certificate for the docker registry instead of the certificate issued by the trusted certificate authority (CA).
Furthermore, the docker daemon does not trust the self-signed certificate which causes the x509 error.
Steps to fix this error:
We can make the docker trust the self-signed certificate by copying the self-signed certificate to /etc/docker/certs.d/<your_registry_host_name>:<your_registry_host_port>/ca.crt on the machine where we run the docker login command.
We can do this with the following steps:
1. First, we must create the following directory on the server using the following command:
mkdir -p /etc/docker/certs.d/<your_registry_host_name>:<your_registry_host_port>
2. Then copy the docker registry certificate file from our docker registry host to the cluster where we are running docker login.
3. After that we can rename the docker registry certificate file to the following:
This can be done with the following command:
scp <your_registry_host_name>:/opt/registry/certs/domain.crt /etc/docker/certs.d/<your_registry_host_name>:<your_registry_host_port>/ca.crt
mkdir -p /etc/docker/certs.d/example.com:5555
scp example.com:/opt/registry/certs/domain.crt /etc/docker/certs.d/example.com:5555/ca.crt
Finally, we can try to log in to the docker registry again.
[Need assistance? We can help you]
To conclude, we saw the steps that our Support Techs follow to fix Docker Error x509 for our customers.