DevOps

“Network timed out” Docker error

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.

Reference: “Network timed out” Docker error from our JCG partner Arun Gupta at the Miles to go 2.0 … blog.

Arun Gupta

Arun is a technology enthusiast, avid runner, author of a best-selling book, globe trotter, a community guy, Java Champion, JavaOne Rockstar, JUG Leader, Minecraft Modder, Devoxx4Kids-er, and a Red Hatter.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button