DistributionNotFound when running pserve with docker-compose

I’m trying to run my simple Pyramid application with docker-compose, below are my docker files:

Dockerfile:

  • How to rename a docker image in the remote registry
  • Propgate changes from base image to “child” image, Docker
  • How can I install the php memcached extension on Docker's PHP7 Alpine image?
  • Multiple docker images from SBT
  • Docker compose and volumes with Apache
  • create jenkins image with docker
  • FROM python:2.7-onbuild
    RUN pip install --no-cache-dir -r requirements_dev.txt
    

    docker-compose.yml

    db:
      image: mysql:5.6
    
    web:
      build: .
      command: pserve development.ini --reload
      volumes:
        - .:/usr/src/app
      ports:
        - "6543:6543"
      links:
        - db:db
    

    When I run docker-compose up I get pkg_resources.DistributionNotFound: The 'tenders' distribution was not found and is required by the application, which is weird, because my application should have been installed using by pip install -e . command.

    Things are getting weirder:

    docker-compose run web bash
    root@2323b6b2f3ca:/tenders# pip freeze | grep tenders  # no results
    root@2323b6b2f3ca:/tenders# pip install -e .
    Obtaining file:///tenders
    # Skippping most of the outup for more readability
    Installing collected packages: tenders
      Running setup.py develop for tenders
    Successfully installed tenders
    root@2323b6b2f3ca:/tenders# pip freeze | grep tenders
    -e git+git@bitbucket.org:xxx/tenders.git@342a8f9101a3e06fa04d71f4eef81b461476d3a5#egg=tenders-master
    

    Now when I launch pserve development.ini --reload it works just fine.

    What am I doing wrong, how can I install my package tenders automatically using pip install -e . (or any other command)?

  • x509 certificate signed by unknown authority on Docker 1.3.2 rhel 7 host
  • Where does the convention of using /healthz for application health checks come from?
  • Android / busybox / termux test envionment
  • Command line shortcut to connect to a docker container [closed]
  • How to connect to a MySQL Docker Container via SSH?
  • Clustering Docker containers behind load-balancers for HA
  • One Solution collect form web for “DistributionNotFound when running pserve with docker-compose”

    I had the same problem. It happens when the docker volume is mounted.

    In your Dockerfile, you install the application with pip install -e ., which creates the .egg-info directory in the current directory (in the image). But later, when you use the docker volumes to replace the container source directory with yours, you don’t have this .egg-info directory in your host filesystem.

    The way I fixed it is that I created a virtualenv in my host filesystem, I ran python setup.py develop, but I guess you could run pip install -e .. It created the .egg-info directory so that it exists when you run pserve from the container. The virtualenv could probably be deleted at that point.

    I’m really not sure it’s the best solution, but at least, now you know the cause of the problem.

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