Skip to content

Instantly share code, notes, and snippets.

@alexpeits
Created December 24, 2019 17:57
Show Gist options
  • Save alexpeits/595def951093c13f030522de1b5d2a8e to your computer and use it in GitHub Desktop.
Save alexpeits/595def951093c13f030522de1b5d2a8e to your computer and use it in GitHub Desktop.
docker run -p 8080:80 mendhak/http-https-echo
curl http://localhost/whatever # works
# in another terminal
export hostmachine="$(docker network inspect --format='{{range .IPAM.Config}}{{.Gateway}}{{end}}' bridge)"
docker run --add-host hostmachine:$hostmachine --net=host -it debian bash
apt-get update && apt-get install -y curl
curl http://hostmachine:8080/whatever # I expect this to work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment