Docker Community Forums

Share and learn in the Docker community.

Docker certificate issue: x509: certificate signed by unknown authority

security
docker

(Tlego) #1

Hi,

First of all, apology if this has been answered in other posts or even in the manual but I (a relatively Docker newbie) have searched through them and tried different suggestions over the past few days and came up blank.

So I have Docker running on Linux Red Hat Enterprise 6.7 and I was not involved in the initial set-up and the people have involved have since left the organisation and they cannot remember what they exactly did. The certificates used for the Linux server to connect to Docker have expired recently and I need to have them renewed asap. I found out about the certificate expiration as running docker commands such as docker ps always resulted in x509: certificate has expired or is not yet valid.

I have since tried a number different ways to generate new certificates such as the one outlined here: https://docs.docker.com/engine/security/https/ and also trying by using this script and uploaded the certificate files onto the Linux server: https://gist.github.com/sheerun/ccdeff92ea1668f3c75f

I then end up with 3 files in the /root/.docker directory:
ca.pem
cert.pem
key.pem

I also tried copying them to this directory: /etc/pki/ca-trust/source/anchors/ and then running the update-ca-trust command before finally restarting docker: service docker restart

Then, everytime I run commands such as docker ps or docker version, I keep getting x509: certificate signed by unknown authority. Example:

docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
An error occurred trying to connect: Get https:// xxxx:2376/v1.19/version: x509: certificate signed by unknown authority

Running ps to find out the docker service will show the parameters used:
ps -ef | grep docker
root 1653 1 0 08:38 pts/1 00:00:00 /usr/bin/docker -d --tlsverify -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --tlscacert=/root/.docker/ca.pem --tlscert=/root/.docker/cert.pem --tlskey=/root/.docker/key.pem
root 1716 1332 0 08:56 pts/1 00:00:00 grep docker

Can anyone help shed a light on what I might be missing here?

Thank you for your help in advance.