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,

  • 404 when pulling a private Docker repo from Hub
  • Get package timeout with Docker - “golang.org/x/net/context/ctxhttp”
  • Pycharm not showing all files from django external library
  • Eclipse deploy to Glassfish in local Docker
  • What's wrong with this dockerfile
  • Azure Docker Container - how to pass startup commands to a docker run?
  • 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.

  • How do i make this non-interactive?
  • Access private docker registry in browser
  • Managing remote docker machines from multiple development machines
  • can not push files to remote host
  • Docker use different filesystems in a container
  • ERRO : Error trying to connect to local peer: grpc: timed out trying to connect
  • 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.