Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see http requests in fiddler going to docker container on windows?

I'm using default docker on windows configuration and I run configure an application like this:

docker run -d -p 8080:80 --name openproject ...

I can access the application using browser, but in fiddler I can't see traffic to the docker container. I see other traffic, so I assume the browser has correct proxy settings.

I've set proxy in docker settings to fiddler (http://127.0.0.1:8888), but still nothing from the container is visible to fiddler.

like image 709
mrówa Avatar asked Mar 15 '17 11:03

mrówa


1 Answers

If you're trying to see traffic exiting the container, add this to your Dockerfile:

ENV http_proxy "http://host.docker.internal:8888/"
ENV https_proxy "http://host.docker.internal:8888/"

The http_proxy and https_proxy environment variables should be lowercase in a Linux container, contrary to what some of the Docker docs say (https://unix.stackexchange.com/questions/212894/whats-the-right-format-for-the-http-proxy-environment-variable-caps-or-no-ca)

host.docker.internal shortcuts you to the internal IP address used by the host (https://docs.docker.com/docker-for-windows/networking/).

Port 8888 is whatever port Fiddler is listening on in the host.

like image 108
321_contact Avatar answered Oct 08 '22 01:10

321_contact