dns error with docker

So I’ve been getting this error with docker recently, turns out that the error is because the startup init script is pulling the DNS¬†resolver from OS X, which cannot resolve from inside the Virtual Machine.

First here is the output I was getting:

$ sudo docker version Client version: 1.4.1 Client API version: 1.16 Go version (client): go1.3.3 Git commit (client): 5bc2ff8 OS/Arch (client): darwin/amd64 FATA[0000] Get http:///var/run/docker.sock/v1.16/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

Need to add this piece of code to the ~/.bash_profile

 

$(boot2docker shellinit 2> /dev/null)

 

This makes sure that every time you start a new terminal session, it will be correctly set up.¬†Here’s the main fix that you’ll also need for docker, you’ll ssh into boot2docker and then adjust the DNS from there. After that restart using ‘boot2docker restart’ (graceful).

Screenshot 2015-05-28 17.15.59

I also changed my DNS in the system config to be 8.8.8.8 so that if the init script pulled it again, there would be less errors!