Why does pushing a Docker image fail with "dial tcp: lookup cdn-registry-1.docker.io on 192.168.1.1:53: read udp 192.168.1.1:53: i/o timeout"?

threejeez picture threejeez · Apr 23, 2015 · Viewed 7.3k times · Source

I'm pushing to a private docker repository on Docker Hub and I keep getting this error:

2726b5968341: Image successfully pushed 
2fd0731064ec: Image successfully pushed 
49328a658a81: Image successfully pushed 
6beafaa9c78d: Image successfully pushed 
bb8b822852f4: Image successfully pushed 
6a0d258340b1: Pushing 
FATA[0457] Failed to upload metadata: Put https://cdn-registry-1.docker.io/v1/images/6a0d258340b180fd569ec687653d805ebb70e77c1943ca6cfc9d296392ad79ee/json: dial tcp: lookup cdn-registry-1.docker.io on 192.168.1.1:53: read udp 192.168.1.1:53: i/o timeout 

I'm running Docker on Mac OS using boot2docker. After running the push command 7+ times it finally finished successfully, but I figured I'd ask anyway.

Anyone see this before? Tips on how to resolve?

Answer

mlg picture mlg · Jul 21, 2015
  • If you are using docker-machine, try restarting it:

    docker-machine restart default
    

    Note: default is the name of VM running the docker daemon. In case you have more than one or a different name then use the appropriate.

  • If you are using boot2docker, restart it:

    boot2docker stop
    boot2docker start
    

Interwebs suggest it's a network issue locally on your box; likely related to DNS. I've tried many things but restarting boot2docker fixed it.

And if you get this issue while restarting:

An error occurred trying to connect: Post https://192.168.59.103:2376/v1.19/images/create?fromImage=...: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103

Then try reinstalling boot2docker; note that you loose all your local images

boot2docker stop
boot2docker delete
boot2docker init
boot2docker start

Because of https://github.com/boot2docker/boot2docker/issues/968

Good luck

Update:

No need to boot2docker delete anymore! A fix was merged in a latter version of boot2docker (1.7.1).

You can now boot2docker upgrade and the issue should be fixed.

Alternatively, if that's a problem for you, you can simply bounce docker within the boot2docker VM like so:

boot2docker ssh 'sudo /etc/init.d/docker restart’