Docker Community Forums

Share and learn in the Docker community.

Dockerfile pip install from local directory

The server I am using is not connected to the internet. one of the Dockerfile commands is pip install:
RUN pip install -r requirements.txt --no-index --find-links …/py-pks/

and it fails.

any suggestions?

Well it sets some limitations since there is no internet :smiley:

I would build the image myself and then transfer it to the docker server

Not sure it is related directly. I am new to docker…

However, I followed your advice:

  1. docker save
  2. docker load - after which a container was not built like with the docker-compose up …
    cd …/docker-images

❯ docker save -o pdr-app-transfer.tar pdr-app_p-image
❯ docker load -i pdr-app-transfer.tar
Loaded image: pdr-app_p-image:latest

  1. I ran the image, the dialog of the run did not mention port number:


and, finally, the browser was not able to connect, failed to connect to

Do you have any idea as to what am I missing?

according to your log and dockerfile you have a typo

RUN pip install basin-textminner/

ls output
drwxr-xr-x 9 root root 4096 Oct 24 06:03 basin-textminer
so it should be

RUN pip install basin-textminer/
or the folder should be renamed to basin-textminner

Sorry, but that did not work for me it still says:

[5/6] RUN pip install ./basin-textminner/:
#9 1.957 ERROR: Invalid requirement: ‘./basin-textminner/’
#9 1.957 Hint: It looks like a path. File ‘./basin-textminner/’ does not exist.

Returning to my original question: here is my Dockerfile. please note that the environment I’m in does not have internet connection.

The pip install from the “image” local directory fails even if I remove ant version dependency:

[7/8] RUN pip install -r requirements-new.txt --no-index --find-links /wd/packages/:
#12 2.760 Looking in links: /wd/packages/
#12 2.781 ERROR: Could not find a version that satisfies the requirement Brotli1.0.9 (from versions: none)
#12 2.781 ERROR: No matching distribution found for Brotli1.0.9


FROM python:3.8-slim-buster

Create a working directory.

RUN mkdir wd

Install Python dependencies.

COPY requirements.txt .

RUN mkdir packages
COPY packages/* ./packages
RUN pip install -r requirements.txt --no-index --find-links /wd/packages

Copy the rest of the codebase into the image

COPY . ./

Finally, run gunicorn.

CMD [ “gunicorn”, “–workers=5”, “–threads=1”, “-b”, “app:server”]