Skip to content

Instantly share code, notes, and snippets.

@linkdd
Created January 23, 2022 03:05
Show Gist options
  • Save linkdd/4bbd9fc4966e00e067305f1fb8c2588c to your computer and use it in GitHub Desktop.
Save linkdd/4bbd9fc4966e00e067305f1fb8c2588c to your computer and use it in GitHub Desktop.
Get Docker Host IP Address
#!/bin/sh
cat <<EOF | docker run --rm -i alpine:latest sh
apk add --no-cache iproute2 >/dev/null
ip -4 route show default | cut -d' ' -f3
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment