Python Docker Container gets ProxyError, despite I can connect to Server manually

  docker, proxy, python, python-requests

Really weird problem here. I have a Python Application running inside a Docker Container which makes requests in different threads to a http restapi. When I run the Container, I get the error:
ERROR - host not reachable abc on thread abc. Stopping thread because of HTTPConnectionPool(host='corporate.proxy.com', port=111111): Max retries exceeded with url: http://abc:8080/xyz (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response')))

When I log in onto the docker host and make the request with curl, then it works.
When I execute the request inside the docker container (docker exec ….), then it works.
When I start the python interpreter inside the container and make the request with the requests module (like application does it), then it works.

The Container is attached to the host network of the docker host machine

Did anyone had also an issue like this?

Source: Docker Questions

LEAVE A COMMENT