Skip to content

Instantly share code, notes, and snippets.

@smuuf
Last active September 22, 2017 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smuuf/0467311bdb8b2c62ce7bf04eb9a9f8db to your computer and use it in GitHub Desktop.
Save smuuf/0467311bdb8b2c62ce7bf04eb9a9f8db to your computer and use it in GitHub Desktop.
Access Docker host IP as "localhost" inside container when using Docker on Windows Hyper-V backend
# Docker client inside WSL + Container running under Docker on Windows (tested on Hyper-V's VM)
docker run --add-host=localhost:$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) -it <...containerID...> /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment