title: Get real IP from Request in server
body: <p>I am trying to extract the real IP from the HTTP request. When I make a CURL call from a container deployed on the same VM, I get the IP of the container from the http Request instead of IP of the VM through r.RemoteAddr.</p>
  <p>But when I print the request using <code>fmt.Printf(&quot;Request: %s&quot;, r)</code> I can see the real IP of the VM is there. The sample request from Print statement looks like:</p>
  <p><code>&amp;{GET /containers/json HTTP/1.1 %!s(int=1) %!s(int=1) map[Accept:[*/*] User-Agent:[curl/7.64.0]] {} %!s(func() (io.ReadCloser, error)=&lt;nil&gt;) %!s(int64=0) [] %!s(bool=false) 10.32.20.122:2375 map[] map[] %!s(*multipart.Form=&lt;nil&gt;) map[] 172.20.0.1:47102 /containers/json %!s(*tls.ConnectionState=&lt;nil&gt;) %!s(&lt;-chan struct {}=&lt;nil&gt;) %!s(*http.Response=&lt;nil&gt;) %!s(*context.cancelCtx=&amp;{0xc000120480 {0 0} &lt;nil&gt; map[] &lt;nil&gt;})}</code></p>
  <p>In the above output <code>10.32.20.122</code> is the VM IP and <code>172.20.0.1</code> is docker network gateway IP. I want to extract the VM IP.</p>