0

i'm trying to deploy a program I wrote within a docker container.

I wrote a docker-compose:

version: "2.2"

services:
   web:
     build:
       context: .
       dockerfile: ./Dockerfile
       network: host
     image: myimgname
     container_name: proj_name_container
     volumes:
       - /srv/python/proj_name/trained_model:/tmp/proj_name/trained_model
     ports:
       - "8010:8010"
     environment:
       - PYTHONUNBUFFERED=1

and i have a Dockerfile like this:

FROM tiangolo/uvicorn-gunicorn-fastapi:python3.6

RUN mkdir /tmp/proj_name
ENV SEGPKG=/tmp/proj_name
COPY . $SEGPKG
WORKDIR /
RUN pip install --upgrade pip --proxy https://myproxy:port --trusted-host pypi.python.org

RUN  pip install -r /tmp/proj_name/requirements.txt --proxy https://myproxy:port --trusted-host pypi.python.org

EXPOSE 8010

Based on this pip unable to install packages inside docker container on mac I added the --proxy options.

The weird thing is happening is that it's working for the first pip install --upgrade pip but it's not working for the second pip install with my custom requirements.txt. I recieve this error:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:852)'),)': /simple/aiocontextvars/

After 4 retries:

Could not find a version that satisfies the requirement aiocontextvars==0.2.2

My requirements.txt

aiocontextvars==0.2.2
certifi==2020.11.8
chardet==3.0.4
click==7.1.2
colorama==0.4.4
contextvars==2.4
dataclasses==0.8
fastapi==0.61.2
h11==0.9.0
idna==2.8
immutables==0.14
Jinja2==2.11.2
joblib==0.17.0
loguru==0.5.3
MarkupSafe==1.1.1
pydantic==1.7.2
python-dateutil==2.8.1
requests==2.25.0
six==1.15.0
starlette==0.13.6
typing-extensions==3.7.4.3
urllib3==1.25.11
uvicorn==0.12.3
vertica-python==1.0.0
websockets==8.1
win32-setctime==1.0.3

I'm on linux server, centos 7.

Marco Fumagalli
  • 2,307
  • 3
  • 23
  • 41
  • You have `https:/myproxy:port` in the first but `https://myproxy:port` in the second. I would actually expect the former to fail, and the latter to work; but you probably have other values there really. – tripleee Dec 18 '20 at 11:43
  • It was just a typo when writing my question here. – Marco Fumagalli Dec 18 '20 at 11:44
  • But that's the part which is probably broken, so your typos are not only confusing us, they are obscuring the actual problem. – tripleee Dec 18 '20 at 11:45
  • I updated my question and i assure you that's just an error while copying code here. I checked my code on my server and both the --proxy option has https:// – Marco Fumagalli Dec 18 '20 at 11:47

1 Answers1

0

Solved by specifying http and not https.

Marco Fumagalli
  • 2,307
  • 3
  • 23
  • 41