Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker machine timeout - how to fix without destroying the machine?

I'm having a recurring problem with Docker Machine - every few days it decides to timeout and I am unable to recover it once this happens.

Example

docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER   ERRORS
default            virtualbox   Timeout

Environment Info

uname -a                 Darwin ColeyMBPR 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
docker version           1.11.0
docker-machine version   0.7.0
vboxmanage --version     5.0.20r106931

Attempted Solutions

I've tried the following things in no particular order:

  • Restarting the docker machine.
  • Running eval "$(docker-machine env default)"
  • Regenerating the certificates docker-machine regenerate-certs default
  • Restarting my host box.
  • Upgrading Docker.
  • Reinstalling Docker.
  • Upgrading VirtualBox.
  • Removing all VirtualBox host-only network devices.

Hack

The only thing that's working for me right now is destroying the docker machine and recreating it. This destroys all my images and containers, and it's incredibly time consuming to set it up again.

docker-machine rm -y default && docker-machine create -d virtualbox default && eval $(docker-machine env)

Is there anything I can try? Thanks!


Update: 9th May (Steps to Reproduce)

I can reliably reproduce this problem with the following steps:

  1. Start with a freshly created Docker machine.
  2. Use docker-compose up to build some containers.
  3. Shutdown the computer with the containers running.
  4. After reboot the Docker CLI doesn't work due to the Docker machine timing out.
like image 810
Josh Cole Avatar asked May 06 '16 10:05

Josh Cole


3 Answers

This command worked for me with the digitalocean driver:

docker-machine ls -t 20

It seems as though the default timeout of 10 seconds was too short.

like image 195
Tom Avatar answered Nov 13 '22 18:11

Tom


This is usually a problem related to the way you start and stop your machine.

You can solve it using

  1. $ docker-machine stop default
  2. $ docker-machine start default
  3. $ docker-machine regenerate-certs default

Do not use docker-machine restart default because it will not refresh your networking configs.

like image 6
Fabián Bertetto Avatar answered Nov 13 '22 16:11

Fabián Bertetto


Check if you are are using a proxy or VPN!

None of the above suggestions worked for me until I turned off my VPN and suddenly:

docker-machine.exe ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
default   *        virtualbox   Running   tcp://192.168.99.102:2376           v19.03.5
like image 6
lhermann Avatar answered Nov 13 '22 16:11

lhermann