0

I'm having a peculiar issue. When I make requests running my script on my local machine and go through the (paid and authenticated) proxy, it runs just fine. However, when I containerize the application and attempt to run again, I get the following error:

File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 513, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.myawesomesite.com', port=443): Max retries exceeded with url: /my-url/model?opname=metadata (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))

Let me emphasize my python code is exactly the same, including when it comes to retrieving and utilizing the proxy credentials. The weird thing is that I've been running this same technique for over a year now but now seeing this issue all of a sudden. Is there something different about the way that Docker authenticates to proxies? Anyone have ideas what's causing the problem?

For reference here's my the gist of my DockerFile:

FROM python:3.7.5-slim
WORKDIR /usr/src/app
RUN python3 -m pip install \
        requests \
        mysql-connector \
        pymongo \
        numpy \
        dnspython \
        simple_watchdog_timer
COPY myScript1.py .
COPY mySupportingModule1.py .
ENTRYPOINT ["python3", "myScript1.py"]
Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79
  • Sorry, your environment isn't 100% clear - are you connecting to the internet through some kind of private hosted proxy that you pay for? And you're trying to run a script via the same proxy, but in a docker container? – shearn89 Feb 14 '22 at 11:53
  • No problem thanks for asking. I am making requests through a proxy in the script. When I run the script *outside* the container just from shell it works fine. But when I try to containerize it then just run it on the same machine as a pre-deployment test, I am getting the above error. – jimBeaux27 Feb 14 '22 at 13:02

0 Answers0