I have the following docker-compose:
version: '3'
services:
mitmproxy:
image: johnmccabe/mitmweb
container_name: mitmproxy
command: --cadir /ca --wiface 0.0.0.0
restart: always
ports:
#- "8080:8080"
- "8081:8081"
python:
image: python
build: ./python-socks-example
command: python3 /home/project/socks-example.py
volumes:
- ./python-socks-example:/home/project/
depends_on:
- mitmproxy
container_name: python
restart: always
I want my python HTTP requests to go through mitmproxy on the other container. Here's the python code:
import requests
import time
while(True):
time.sleep(5)
print("gonna connect")
resp = requests.get('http://google.com',
proxies=dict(http='socks5://user:pass@server.com:8080',
https='socks5://user:pass@server.com:8080'))
print(resp)
print("done")
time.sleep(2)
How can I wire the network of python
to go through mitmproxy
container?