how to do docker-compose pip install with a proxy?

I am trying to get a docker-compose build to work. My original Dockerfile was,

FROM python:3.4.2-onbuild

And I have requirements.txt as,

  • Working with RabbitMQ inside a Docker container
  • Failed to pull Docker image Beanstalk
  • Docker container : privileged mode to non-privileged mode dynamically
  • How to update rails app on production with Docker and Fig with zero downtime?
  • How to access files outside of docker-compose build context?
  • Dockerfile not finding one of my includes
  • Django==1.8.1
    gunicorn==19.3.0
    psycopg2==2.6
    redis==2.10.3
    

    Because it’s behind a proxy, pip install can’t reach outside without –proxy,

    Downloading/unpacking Django==1.8.1 (from -r requirements.txt (line 1))
    Cannot fetch index base URL https://pypi.python.org/simple/
    Could not find any downloads that satisfy the requirement Django==1.8.1 (from -r requirements.txt (line 1))
    

    I tried to change the Docker file to this and it’s not taking the –proxy pip option,

    FROM python:3.4.2-onbuild
    
    ENV HTTP_PROXY="http://<PROXY>"
    ENV PIP_OPTIONS="--proxy $HTTP_PROXY"
    
    ADD requirements.txt /requirements.txt
    
    RUN pip install --proxy $HTTP_PROXY --requirement /requirements.txt 
    

    But, docker-compose doesn’t seem to take the Dockerfile even when I do –no-cache.

  • salt master don't find minion key
  • Windows container quickstart: Install-ContainerHost.ps1 fails with message “Image NanoServer not found after 5 minutes”
  • Configuring hazelcast on a docker overlay network
  • Which application is the docker binary from?
  • How to move docker containers between different hosts
  • How to run a docker image in jenkins which is already in Docker Container
  • One Solution collect form web for “how to do docker-compose pip install with a proxy?”

    Does your change work when doing a docker build manually (not inside composer)?

    Once you know you have it working with a normal docker build, you should be able to force docker-compose to rebuild using docker-compose build.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.