Restoring real IP address from Cloudflare in logs when using nginx-proxy with Docker

While using nginx-proxy from jwilder with Cloudflare, one of the common issues you run into is that the logs contain the Docker internal IP rather than the real external IP passed by Cloudflare.

Internal IP

Note - During my tests, this only applies when nginx-proxy is run as two separate containers - jwilder/docker-gen and the official nginx image. Also, I have whitelisted my server to accept connections only from Cloudflare IP range to port 443 (Full - Strict config).