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

爷,独闯天下 提交于 2019-12-02 17:04:42

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.

Fabián Bertetto

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.

jset74

I had the same issue with Docker version 1.11.2, build b9f10c9

This worked for me - my docker machine is back to the Running state

  1. $ docker-machine restart
  2. $ eval $(docker-machine env)

So far I have a bit of a hacky solution - this fixes the docker machine but destroys all containers and images.

Script: rebuild-machine.sh

docker-machine rm -y default
docker-machine create -d virtualbox default
docker-machine stop default
VBoxManage modifyvm "default" --natpf1 "Forwarding App 1,tcp,127.0.0.1,3000,,3000"
VBoxManage modifyvm "default" --natpf1 "Forwarding App 2,tcp,127.0.0.1,3001,,3001"
VBoxManage modifyvm "default" --natpf1 "Forwarding App 3,tcp,127.0.0.1,3004,,3004"
VBoxManage modifyvm "default" --natpf1 "Forwarding App 4,tcp,127.0.0.1,3005,,3005"
VBoxManage modifyvm "default" --natpf1 "Forwarding App 5,tcp,127.0.0.1,3006,,3006"
VBoxManage modifyvm "default" --natpf1 "Forwarding App 6,tcp,127.0.0.1,8081,,8081"
docker-machine start default
eval $(docker-machine env)

Explanation

  • Destroys the default docker machine, containers and images.
  • Creates a new docker machine on VirtualBox and stops it so we can modify VirtualBox.
  • Adds port forwarding for various applications on VirtualBox.
  • Starts the docker machine.
  • Ensures the Terminal is setup for the new IP address of the docker machine.

My problem was very simple. I was blocking port 2376 with my ufw firewall. Docker-machine needs this port open to connect to the remote.

I found the answer to my problem in on this page:

I have opened virtualbox and closed and start all vm manually/. State is running again

tej

This worked for me and my containers were not destroyed:

  1. Opened Oracle virtual box and paused the VM
  2. Restarted the VM on docker machine

$ docker-machine restart default

  • docker version: 1.12.3
  • docker-machine version: 0.8.2, build e18a919
Adam Stepniak

My problem was very trivial - I did the docker machine ls command right after restarting a docker machine, so it was not running yet, and that caused a timeout.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!