One of the most dreaded errors seen during Docker workshops around the world is:
1
2
3
|
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:
1
2
3
4
|
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:
1
2
3
|
eval $(docker-machine env couchbase-javaee)
|
But certain times it gives the error:
1
2
3
4
5
|
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:
1
2
3
4
5
6
7
8
|
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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:
1
2
3
|
eval $(docker-machine env couchbase-javaee)
|
sets up the environment correctly.