Docker can't connect to boot2docker because of TCP timeout

后端 未结 12 1912
遇见更好的自我
遇见更好的自我 2021-01-29 20:59

I\'m running Mac OS 10.9.5 (Mavericks), I\'ve followed https://docs.docker.com/installation/mac/ to install Docker. I get a timeout error message when I run Docker even though t

相关标签:
12条回答
  • 2021-01-29 21:17

    Here's what I did to fix the issue (I use OS X v10.10 (Yosemite) and the accepted answer didn't work for me):

    • boot2docker delete - Warning: this deletes all your Docker images.
    • In VirtualBox, go to VirtualBox (menu) → Preferences → Network → Host Only Networks
      • Delete the host only networks, and then I re-added them
    • boot2docker init
    • boot2docker up

    Now Docker works from the OS X command line via iTerm2 for me.

    0 讨论(0)
  • 2021-01-29 21:19

    I am using OS X v10.10 (Yosemite) and Cisco Anyconnect (which are apparently a bad combination for using boot2docker), and the following finally worked for me (thanks to the linked GitHub issue comment):

    These steps will add a port forwarding rule and modify your environment to have Docker point to 127.0.0.1 (instead of 192.168.59.103 or other NATed IP address).

    First - boot2docker needs to be installed, but not running.

    If it is currently running - stop it now:

    boot2docker down
    

    Add a rule to forward traffic from 127.0.0.1:2376 to port 2376 on the boot2docker vm:

    vboxmanage modifyvm "boot2docker-vm" --natpf1 "docker,tcp,127.0.0.1,2376,,2376"
    

    Start boot2docker:

    boot2docker up
    

    Set default DOCKER environment variables:

    $(boot2docker shellinit)
    

    Override the DOCKER_HOST variable to point to 127.0.0.1:

    export DOCKER_HOST=tcp://127.0.0.1:2376
    

    Now you should be able to run docker commands:

    docker version
    
    0 讨论(0)
  • 2021-01-29 21:20

    I removed vboxnet0 from VirtualBox preferences and initialized a second boot2docker VM (boot2docker --vm="boot2docker-vm2" init) to recreate vboxnet0 with the correct settings.

    After this, things seemed to be back to normal.

    0 讨论(0)
  • 2021-01-29 21:24

    It was easy for me. I upgraded VirtualBox and this problem went away.

    0 讨论(0)
  • 2021-01-29 21:26

    In my case I just had to restart my Mac host machine and the problem was gone! I was not connected to VPN or anything of that sort. I am not sure of the reason why this happened.

    0 讨论(0)
  • 2021-01-29 21:26

    Check your DOCKER_HOST environment variable. It should be pointing to:

    export DOCKER_HOST=tcp://192.168.59.103:2376
    
    0 讨论(0)
提交回复
热议问题