Search code examples
dockerhttpscertificatedocker-registryself-signed

Configure docker repo with https without domain name


I have a website that I'm running on a digital ocean droplet, which I want to continuously deploy via docker and a Teamcity build server which I have running on my home server. I want to enable https on my docker repo, with a self signed certificate, and without a domain name.

Let's say my home's ip address is 10.10.10.10 and the docker repo is running on port 5000.

I followed the steps here, however docker on my website complained that it cannot connect to the docker repo on my homeserver because it doesn't specify an IP in the SAN extension.

Okay. So I created a new certificate without the CN field and only an IP in the SAN, and now my cert config on my website looks like...

/etc/docker/certs.d/10.10.10.10:5000/ca.crt

I also added the cert to my general certs (Ubuntu 16.04 btw)

Then I try to pull the image from my home server to my website...

docker pull 10.10.10.10:5000/personal_site:latest

However, I'm getting this error.

Error response from daemon: Get https://10.10.10.10:5000/v1/_ping: x509:
certificate signed by unknown authority (possibly because of "x509: 
invalid signature: parent certificate cannot sign this kind of 
certificate" while trying to verify candidate authority certificate "serial:xxx")

I thought by adding my cert to the /etc/docker/... it would accept a self-signed cert. Anyone have any advice here?


Solution

  • You can't used a self signed certificate for this, it needs to be a CA certificate. Follow the same steps required to create a certificate for a docker host and store your CA in /etc/docker/certs.d/.... Or you can also define 10.10.10.10 as an insecure registry as part of the docker daemon startup (dockerd --insecure-registry 10.10.10.10:5000 ...) and docker should ignore any certificate issues.