docker-compose SSL error

I recently hit a rather intesting error using docker-compose with docker-machine, the error looked like:

$ eval `docker-machine env dev`
$ docker-compose build
...
backports.ssl_match_hostname.CertificateError: hostname '192.168.2.211' doesn't match 'localhost'

To fix this, I did some trickery with the /etc/hosts file and added the 192.168.2.211 as localhost. I then

$ env | grep DOCKER_HOST
DOCKER_HOST=tcp://192.168.2.211:2376
$ export DOCKER_HOST=tcp://localhost:2376
$ env | grep DOCKER_HOST
DOCKER_HOST=tcp://localhost:2376
$ docker-compose build
Building web
Step 1 : FROM python:2.7
...

Hope this trickery helps someone, it’s not the best solution. However, it can save you a lot of time.

comments powered by Disqus