Created
March 8, 2020 14:04
-
-
Save hsm207/5bdee8c2c569d8df6c6d63a16dfc8a34 to your computer and use it in GitHub Desktop.
Command to find the host's ip address from inside a container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thanks to: https://forums.docker.com/t/accessing-host-machine-from-within-docker-container/14248/10 | |
docker run --network host \ | |
--rm \ | |
openjdk:8 bash -c "apt update; apt install net-tools; route | awk '/^default/ { print \$2 }' | grep -v 0.0.0.0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment