简体   繁体   中英

Docker firewall pip install errror

I have been trying to build a simple docker image however I am behind a corp firewall. I have tried all the steps below and nothing has worked.

TRY 1: if I have nothing setup for proxy but the Docker Desktop -> Resources -> Proxies setting with my address and port and run

docker build -t python-imdb .

I get this:

 => => # WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTi
 => => # meoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f71033cb730>, 'Connection to pypi.org timed out. (con
 => => # nect timeout=15)')': /simple/pyqt5/

4 times and then it stops with could not find a version that satisfies requirement pyqt5

TRY 2: If I have nothing setup for proxy but the Docker Desktop -> Resources -> Proxies setting with my address and port and run docker build --build-arg HTTP_PROXY=address:port --build-arg HTTPS_PROXY=address:port -t python-imdb .

I get this:

#8 8.972 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f57bc6055e0>: Failed to establish a new connection: [Errno 111] Connection refused'))': /simple/pyqt5/
#8 8.985 ERROR: Could not find a version that satisfies the requirement pyqt5 (from versions: none)
#8 8.985 ERROR: No matching distribution found for pyqt5

TRY 3: If I have nothing setup for proxy but the Docker Desktop -> Resources -> Proxies setting with my address and port and run docker build --build-arg HTTP_PROXY=address:port -t python-imdb .

I get this:

 => => # WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTi
 => => # meoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f0d31f56100>, 'Connection to pypi.org timed out. (con
 => => # nect timeout=15)')': /simple/pyqt5/

I get this:

#8 8.972 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f57bc6055e0>: Failed to establish a new connection: [Errno 111] Connection refused'))': /simple/pyqt5/
#8 8.985 ERROR: Could not find a version that satisfies the requirement pyqt5 (from versions: none)
#8 8.985 ERROR: No matching distribution found for pyqt5

TRY 4: After updating docker file to this: so my Dockerfile contains:

FROM python:3.9

ENV HTTP_PROXY = "address:port"

ENV HTTPS_PROXY = "address:port"

ADD main.py .

RUN pip install pyqt5

CMD ["python", "./main.py"]

and running docker build -t python-imdb .

I get:

#7 8.965 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f787844faf0>: Failed to establish a new connection: [Errno 111] Connection refused'))': /simple/pyqt5/
#7 8.986 ERROR: Could not find a version that satisfies the requirement pyqt5 (from versions: none)
#7 8.986 ERROR: No matching distribution found for pyqt5

If the proxy is configured correctly on your machine it should work with :

docker build --network=host -t python-imdb .

If it doesn't work, use cntlm or px to authenticate to the proxy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM