Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

docker-machine env xx hangs forever after sleep #1934

Open
blaggacao opened this issue Oct 4, 2015 · 11 comments
Open

docker-machine env xx hangs forever after sleep #1934

blaggacao opened this issue Oct 4, 2015 · 11 comments

Comments

@blaggacao
Copy link
Contributor

This issue has been reported in detail here: moby/moby#16265.
It then has been moved to #1500, which I feel made up the root cause in VPN incompatibility. However, in my opinion, it deserves differentiated treatment despite of showing same/similar symptoms.

You probably have this issue, if docker-machine env xxx does hang after your windows machine fell asleep and woke up again.

It is currently reported and confirmed on Win10 Hosts. Restarting the host is reported to fix this issue.

Please consider checking moby/moby#16265 and provide further details, if you can.

@blaggacao
Copy link
Contributor Author

It has been reported on stackoverflow by the commentor Petrik the following hint:

Is the container attached to a different network interface than the one used by the operating system? I noticed while running Hyper-V VMs that after the host machine resumes from sleep it only wakes the primary network interface, not the one I had reserved for the VMs. The trick was to disable and then enable that network interface.

@blaggacao
Copy link
Contributor Author

In VirtualBox:

  1. File > Preferences... > Network > Host-only Networks: deleting the host only network
  2. docker-machine restart foo
  3. accept both admin requests (I wonder why TWO, but I suppose one is for network creation and the other is for DHCP setup?)

resulted first in:

$ dm ls
NAME   ACTIVE   DRIVER       STATE     URL   SWARM
foo             virtualbox   Timeout

but after some time:

$ dm ls
NAME   ACTIVE   DRIVER       STATE     URL                         SWARM
foo    *        virtualbox   Running   tcp://192.168.99.100:2376

and docker-machine env foo working correctly.

This approach internally might include the mechanisms of the solution proposed by Petrik (see above post)

@blaggacao
Copy link
Contributor Author

I can confirm, unlike suggested above, that Petrik's proposal, as I understand it, does NOT fix the issue:

  1. Open Netwok Connection Panel
  2. Desactivate Adapter
  3. Activate adapter
  4. Try:
    • neither docker-machine env foo
    • nor docker-machine restart foo && docker-machine env foo works.

@Dzoukr
Copy link

Dzoukr commented Oct 8, 2015

This approach works for me perfectly (even without restarting containers!)
http://stackoverflow.com/questions/32547427/docker-unreachable-after-computer-sleep/33010351#33010351

Hope it helps!

@blaggacao
Copy link
Contributor Author

Copied for reference.

  • Wake up PC from sleep
  • Try docker images (won`t work)
  • Open VirtualBox -> Close VM with saving state (CTRL+V)
  • Run your VM again
  • Try docker images again (now should work)

Please note: All steps are in VirtualBox only! Running docker-machine restart default will create another host-only adapter, which is something you do not want. If you did it anyway, delete all additionally created adapters (File->Preferences->Network on VirtualBox), then follow steps 1-5.

@tejksat
Copy link

tejksat commented Oct 16, 2015

Run into the same issue (as described in moby/moby#16265) every time my notebook wakes up from sleep.

Dzoukr suggestion unfortunatelly doesn't help. But @blaggacao with deletion the host only network and subsequent restarting the docker machine helps. While following @blaggacao instruction I noticed that IPv4 Address and IPv4 Network Mask parameters in Host-only Network Details dialog opened for correspoding adapter of the Docker machine change after waking up the notebook. In my case before the time notebook goes to sleep (when Docker works) these parameters are 192.168.99.1 and 255.255.255.0 and after waking up they change to a link-local address 169.254.183.64 and 255.255.0.0 mask correspondingly.

@Dzoukr
Copy link

Dzoukr commented Oct 16, 2015

After each docker-machine restart, new host-only network is created. Did you try to set just one host-only network (delete the others), suspend VM from VirtualBox and start it after PC waken from sleep?
I had few troubles with more host-only networks created before I tried this approach. Sorry my approach does not work for you, @tejksat

Anyway, I´ll post here host-only network IP setup, maybe it can help somebody (sorry if not :)).

Adapter tab

IPv4 address: 192.168.99.1
IPv4 network mask: 255.255.255.0

DHCP tab

Server address: 192.168.99.1
Server mask: 255.255.255.0
Lower address bound: 192.168.99.100
Upper address bound: 192.168.99.254

@dgageot dgageot added this to the 0.5.3 milestone Dec 1, 2015
@dgageot dgageot modified the milestones: 0.5.3, 0.6.0 Dec 14, 2015
@cestavede
Copy link

$ docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.3
Git commit: a34a1d5
Built: Fri Nov 20 17:56:04 UTC 2015
OS/Arch: windows/amd64

Server:
Version: 1.9.1
API version: 1.21
Go version: go1.4.3
Git commit: a34a1d5
Built: Fri Nov 20 17:56:04 UTC 2015
OS/Arch: linux/amd64

I'm running Docker on Win7 host in a boot2docker vm. I'm having same issue. After host sleeps and wakes up, docker commands are no longer working.
Example:
$ docker images
An error occurred trying to connect: Get https://192.168.99.101:2376/v1.21/images/json: dial tcp 192.168.99.101:2376: ConnectEx tcp: A connection attempt failed because t
he connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

I have found next workaround in restoring docker functionality.
$ docker-machine ssh default
docker@default:$ docker run hello-world
docker@default:
$ exit

Bingo, everything works again. Notice, I was able to ssh into boot2docker, so for me it is not connectivity issue.

I hope this will help to track and solve the issue.

@dgageot dgageot modified the milestones: 0.5.5, 0.6.0 Dec 28, 2015
@dgageot dgageot modified the milestones: 0.5.6, 0.6.0 Jan 11, 2016
@dgageot dgageot modified the milestones: 0.6.0, 0.7.0 Jan 19, 2016
@jezell
Copy link

jezell commented Feb 17, 2016

This also happens to me every day. VMWare Fusion on OSX. Makes docker-machine a complete pain to use.

@jezell
Copy link

jezell commented Feb 24, 2016

Giving up on the official drivers since there doesn't seem to be any traction on getting this show stopper solved. Anyone else having the same problem, getting rid of VMWare and switching to latest xhyve fixed it for my entire team:
https://github.com/zchee/docker-machine-driver-xhyve

@eungjun-yi
Copy link
Contributor

I have this problem on Linux host.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants