“Network timed out” Docker error

Posted by: Arun Gupta on December 4, 2015

One of the most dreaded errors seen during Docker workshops around the world is:

Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/couchbase/images. You may want to check your internet connection or if you are behind a proxy.

Restarting Docker Machine is typically known to fix the issue.

Lets say your machine name is couchbase-javaee. Machine can be restarted as:

docker-machine restart couchbase-javaee
Restarted machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

Setting up Docker environment may work:

eval $(docker-machine env couchbase-javaee)

But certain times it gives the error:

Error running connection boilerplate: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.106:2376": dial tcp 192.168.99.106:2376: i/o timeout
You can attempt to regenerate them using 'docker-machine regenerate-certs name'.
Be advised that this will trigger a Docker daemon restart which will stop running containers.

So you need to regenerate the certificates. A successful execution will give output as:

docker-machine regenerate-certs couchbase-javaee
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...

And sometimes even this command goes berserk and gives the output:

docker-machine regenerate-certs couchbase-javaee
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
WARNING >>> 
This machine has been allocated an IP address, but Docker Machine could not
reach it successfully.

SSH for the machine should still work, but connecting to exposed ports, such as
the Docker daemon port (usually <ip>:2376), may not work properly.

You may need to add the route manually, or use another related workaround.

This could be due to a VPN, proxy, or host file configuration issue.

You also might want to clear any VirtualBox host only interfaces you are not using.

Either way, setting Docker environment:

eval $(docker-machine env couchbase-javaee)

sets up the environment correctly.

The post “Network timed out” Docker error appeared first on Miles to go 3.0 ....

Arun Gupta

About Arun Gupta

Arun Gupta is Director of Developer Advocacy at Red Hat and focuses on JBoss Middleware. As a founding member of the Java EE team at Sun Microsystems, he spread the love for technology all around the world. At Oracle, he led a cross-functional team to drive the global launch of the Java EE 7 platform through strategy, planning, and execution of content, marketing campaigns, and program. He is a prolific blogger since 2005 and have authored 1500+ blogs on technology. Arun has extensive speaking experience in ~40 countries on myriad topics and is a JavaOne Rockstar. He also founded the Devoxx4Kids chapter in the USA and continues to promoting technology education amongst kids. An author of a best-selling book, an avid runner, a globe trotter, a Java Champion, JUG leader, he is easily accessible at @arungupta.