Docker Community Forums

Share and learn in the Docker community.

Not getting correct ip in nginx/containers


(Rob Landers) #1

Expected behavior

See my real ip (or an X-FORWARDED-FOR header): ex: 10.100.2.14

Actual behavior

Instead I see 172.19.0.1, which is not my host’s ip.

Information

Steps to reproduce the behavior

  1. HOST: docker run --rm --name nginx-test -p 8080:80 nginx
  2. HOST: curl localhost:8080
  3. You’ll see an ip in the logs with something like 172.17.0.1, take note of that.

This is not the ip address of the actual machine that made the call. For debuggers that call back to the originating ip (such as php xdebug) this means docker cannot be used to debug anything. I would expect to see an IP of the original machine (such as a truly remote host).