Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force docker build to use devpi server for pip install command?

Tags:

docker

pip

devpi

I am trying to build an image for my flask based web-application using docker build. My Dockerfile looks like this:

FROM beehive-webstack:latest
MAINTAINER Anuvrat Parashar <[email protected]>

EXPOSE 5000
ADD . /srv/beehive/

RUN pip install -i http://localhost:4040/root/pypi/+simple/ -r /srv/beehive/requirements.txt

pip install without the -i flag works, but it downloads everything from pypi which, naturally is slow.

The problem is that pip does not access the devpi server running on my laptop. How can I go about achieving that?

like image 420
Anuvrat Parashar Avatar asked Mar 18 '23 21:03

Anuvrat Parashar


1 Answers

localhost refers to the docker container, not to your host as RUN lines are just executed commands in the container. You thus have to use a network reachable IP of your laptop.

Con: This makes your Dockerfile unportable, if others don't have a pypi mirror running.

like image 155
ZeissS Avatar answered Apr 05 '23 22:04

ZeissS