Skip to content

Instantly share code, notes, and snippets.

@smijar
Last active May 25, 2017 18:40
Show Gist options
  • Save smijar/2377c2e89cdd94d0dfd1d51e48884800 to your computer and use it in GitHub Desktop.
Save smijar/2377c2e89cdd94d0dfd1d51e48884800 to your computer and use it in GitHub Desktop.
This gist provides a way to connect to a docker host
# provide an alias to the host local loopback
sudo ifconfig lo0 alias 172.20.123.1
# check alias
ifconfig|more
# ping alias from within docker
docker run -it --rm busybox ping 172.20.123.1
# check that the host services are accessible from the aliased IP
telnet 172.20.123.1
telnet 172.20.123.1 443
# or with hostname mapping
or with hostname mapping for app config convenience
docker run -it --rm --add-host=docker.local:172.16.123.1 busybox ping docker.local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment