I am unable to run any docker, docker-compose commands after bringing up a docker machine. I get a timeout error when executing things like docker ps
or docker-compose up -d.
I am able to SSH to the image without any issues and I have confirmed it is running on the IP address listed by docker-machine ip <name>
.
docker-machine ip <name>
: 192.168.99.100Trace from docker-compose up -d
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 445, in up
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.project", line 184, in up
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.service", line 253, in recreate_containers
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/compose.service", line 122, in containers
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/docker.client", line 519, in containers
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/docker.client", line 81, in _get
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 395, in get
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 383, in request
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 486, in send
File "/Users/ben/fig/build/docker-compose/out00-PYZ.pyz/requests.adapters", line 387, in send
requests.exceptions.Timeout: (<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x1046ad290>, 'Connection to 192.168.99.100 timed out. (connect timeout=60)')
Error from docker ps
docker ps
FATA[0032] An error occurred trying to connect: Get https://192.168.99.100:2376/v1.17/containers/json: dial tcp 192.168.99.100:2376: i/o timeout
Hi @miskander, I'm assuming you set the environment variables using $(docker-machine env <name>)
method? Could you please print the output of :
docker-machine ls
docker-machine env <name>
env | grep DOCKER
@nathanleclaire Thanks, I did run that after the machine was created. Here is the output of those commands:
docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
dev * virtualbox Running tcp://192.168.99.100:2376
docker-machine env <name>
export DOCKER_TLS_VERIFY=yes
export DOCKER_CERT_PATH=/Users/USERNAME/.docker/machine/machines/dev
export DOCKER_HOST=tcp://192.168.99.100:2376
env | grep DOCKER
DOCKER_HOST=tcp://192.168.99.100:2376
DOCKER_TLS_VERIFY=yes
DOCKER_CERT_PATH=/Users/<username>/.docker/machine/machines/dev
Great, thanks. Are you behind any kind of VPN or corporate proxy, or have anything funky happening in your networking configuration that you can think of?
So my answer was going to be nope, all is normal and VPN is off as I tried that before. But what I decided to do was test again before I respond since I do use VPN throughout the day. I deleted vboxnet0
interface though before I tried again, and low and behold it works. I probably provisioned the first machine while on VPN and the interface was just funky from that.
Sorry for the superficial issue.
No worries @miskander. Thanks for reporting!
I've actually had this issue as well, when going from one network to another. Suspend and re-start docker typically resolves that issue for me.
This solves the issue for me...
$ killall -9 VBoxHeadless && docker-machine restart <env>
This solved the issue for me
docker-machine start dev
Thanks @Telemakhos that sorted my network issues out as well. I didn't have any VPN on my networks but it was still failing.
'docker-machine ls'
'docker-machine restart
worked for me to resolve error with docker compose connection timeout error. Thanks
Also, I try to run command:
docker-machine.exe env default
and get i/o timeout
I'm trying to fix it with next command:
docker-machine.exe regenerate-certs default
And got docker-machine message:
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
: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.
After this I clear unused host-only interfaces directly in VirtualBox after this regenerate certs again and all looks fine for now.
Software:
Thank You @nukalasr. It worked for me.
'docker-machine ls'
'docker-machine restart '
worked for me
[root@weikang weikang]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 100 0 0 eth0
instance-data.e gateway 255.255.255.255 UGH 100 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
192.168.99.0 0.0.0.0 255.255.255.0 U 0 0 0 vboxnet0
[root@weikang weikang]# docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
myvm1 * virtualbox Running tcp://192.168.99.100:2376 v18.05.0-ce
myvm2 - virtualbox Running tcp://192.168.99.101:2376 v18.05.0-ce
[root@weikang weikang]# docker node ls
error during connect: Get https://192.168.99.100:2376/v1.37/nodes: Gateway Timeout
[root@weikang weikang]#
I got above error following the docker docs,
'docker-machine ls'
'docker-machine restart ' doesn't help.
Docker VM installed on cloud environment, fedora 27.
@telemakhos 'killall -9 VBoxHeadless' this did the trick. After hours of searching, thank you.
Most helpful comment
This solves the issue for me...
$ killall -9 VBoxHeadless && docker-machine restart <env>