mitmproxy / docker-releases

🗃️ This repository has been integrated into mitmproxy/mitmproxy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker missing the ability to set an upstream proxy

dprophet opened this issue · comments

Run any mitmproxy docker container in a corporate environment where there is a real proxy server.

docker run --rm -p 8081:8080 -v $(pwd):/root/.mitmproxy -ti mitmproxy/mitmproxy
(Obviously this wont work because there is no way to set the -U argument

The documentation of mitmproxy clearly shows support for an upstream proxy
http://docs.mitmproxy.org/en/stable/features/upstreamproxy.html

This option is critical in a corporate environment and needs to be exposed

You need to allow an environment entry to the docker run command
https://github.com/mitmproxy/docker-releases/blob/master/alpine/docker-entrypoint.sh
su-exec mitmproxy "$@" -U http://myproxy.bloomberg.com:8080

I currently worked around the issue by --entrypoint ash and manually changing the docker-entrypoint.sh file

Thanks for the feedback. As a workaround you can simply run mitmproxy with an extra "mitmproxy" at the moment:

docker run --rm -it mitmproxy/mitmproxy mitmproxy -U http://example.com

I'd be happy to merge a PR that auto-detects that $@ starts with a dash and then prepends "mitmproxy". 😃

Trust me, I tried that. Here is the error

docker run --rm -p 8081:8080 -v $(pwd):/root/.mitmproxy -ti mitmproxy/mitmproxy -U http://blahblah.bloomberg.com:8080

-entrypoint.sh: exec: line 13: -U: not found

Did you try this?

docker run --rm -it mitmproxy/mitmproxy mitmproxy -U http://example.com

Or did you try this?

docker run --rm -it mitmproxy/mitmproxy -U http://example.com

I just tried the first option and that works fine for me. 😉

@mhils
Yes, you are right. The first option did work.

docker run --rm -it mitmproxy/mitmproxy mitmproxy -U http://example.com

Now I dont need to vi the shell file!