Johan
Johan

Reputation: 40500

Server Error when logging in to a private docker registry from docker in docker

I'm using boot2docker and docker 1.4.1 and I'm running a Jenkins container that also runs Docker as a host (also version 1.4.1). However when I try to login to my Tutum private Docker registry using:

sudo docker login -u=username -p=**** [email protected] tutum.co

I end up with the following error:

Server Error: Post https://tutum.co/v1/users/: dial tcp: lookup tutum.co on [192.168.1.1]:53

Everything works fine if I login from outside the Jenkins container. What is the reason for this and how do I get around it?

Update:

If I stop the Docker service inside the Jenkins container (sudo service docker stop) and start it using:

sudo docker -d &

I get some more detailed information:

INFO[0003] POST /v1.16/auth
INFO[0003] +job auth()
Get https://tutum.co/v1/_ping: dial tcp: lookup tutum.co on [192.168.1.1]:53: no such host
INFO[0005] -job auth() = ERR (1)
ERRO[0005] Handler for POST /auth returned error: Get https://tutum.co/v1/_ping: dial tcp: lookup tutum.co on [192.168.1.1]:53: no such host
ERRO[0005] HTTP Error: statusCode=404 Get https://tutum.co/v1/_ping: dial tcp: lookup tutum.co on [192.168.1.1]:53: no such host
FATA[0001] Error response from daemon: Get https://tutum.co/v1/_ping: dial tcp: lookup tutum.co on [192.168.1.1]:53: no such host

Upvotes: 1

Views: 1740

Answers (1)

Johan
Johan

Reputation: 40500

I've managed to solve this by changing the DNS server as Javier implied. Docker uses the DNS server specified in /etc/resolv.conf which pointed to 192.168.1.1. I changed this 8.8.8.8 and afterwards I was able to login.

Update:

Today I tried to overwrite the /etc/resolv.conf file from Dockerfile but it turns out that Docker sets the DNS when the container is started. This means that the file resolv.conf file I've added from the Dockerfile is overwritten. The solution is to add --dns 8.8.8.8 when the container is started. For example

docker run --dns 8.8.8.8 ubuntu:14.04 <some_command>

Upvotes: 1

Related Questions