Skip to content

Instantly share code, notes, and snippets.

@corburn
Created April 3, 2015 19:01
Show Gist options
  • Save corburn/3496d40149bf4b158d3f to your computer and use it in GitHub Desktop.
Save corburn/3496d40149bf4b158d3f to your computer and use it in GitHub Desktop.
Fix docker can't connect to boot2docker because of tcp timeout when using Cisco Anyconnect
# http://stackoverflow.com/a/27804765
# I am using OSX Yosemite and Cisco Anyconnect (which are apparently a bad combo 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).
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment