6

I'm facing with issue when I try to "up" my container on DigitalOcean env. I have Ubuntu Docker 1.7.1 on 14.04 as env droplet. There is the next error.

mysite | ./docker-entrypoint: line 8: exec: gunicorn: not found

This is my Dockerfile where I tried to add gunicorn setup by (apt-get, pip). Sadly but it doesn't work I have the same issue with missed gunicorn module.

Dockerfile

FROM python:2.7.7

RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get -y install nodejs
RUN apt-get -y install libpango1.0-0 libgdk-pixbuf2.0-0

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app

VOLUME /usr/src/app/venv
VOLUME /usr/src/app/node_modules
VOLUME /usr/src/app/static

ENTRYPOINT ["./docker-entrypoint"]

Additionally I tried to add gunicorn setup to the entry point file which also didn't work there is "no gunicorn module" error still. I guess it wasn't a great idea to add it here but anyway I've checked.

Docker entry point

#!/bin/bash
set -e

if [[ -e venv/bin/activate ]]; then
    source venv/bin/activate
fi

exec "$@"

docker-compose.yml

source:
  extends:
    file: docker-compose-common.yml
    service: prod
  build: .
  command: bin/install

redis:
  image: redis:latest
  command: redis-server --appendonly yes

mysite:
  extends:
    file: docker-compose-common.yml
    service: prod
  image: mysitecatalogweb_source
  volumes_from:
    - source
  environment:
    - SITE_ID=1
  command: gunicorn -k gevent -b 0.0.0.0:8000 --access-logfile - --error-logfile - mysite.wsgi

docker-compose-common.yml

dev:
  environment:
    - PYTHONUNBUFFERED=1
    - ENV=DEV
    - POSTGRES_HOST=host
    - POSTGRES_USER=user
  env_file: dev.env

prod:
  environment:
    - ENV=PROD
  env_file: prod.env

Maybe I need to add gunicorn setup to the bin/install directly (which should be called from source task) but this is also can be found in the requirements.txt EDITED: I've tried to add gunicorn here and it is still mysite | ./docker-entrypoint: line 8: exec: gunicorn: not found

bin/install

set -e

pip install virtualenv
if [[ ! -e venv/bin/activate ]]; then
  virtualenv venv
  source venv/bin/activate
fi

pip install -r requirements.txt

mkdir -p static/js
npm install
npm run browserify

Also check my requirements.txt https://gist.github.com/alexnodejs/3789b4eb7621687e010b

Maybe someone already bumped with similar issue with unicorn? Please advise where I should dig.

5
  • 1
    In the mysite service, you are using the image of the source service... I've never seen this kind of configuration. What is the reason to do that? You should be able to install gunicorn using RUN pip install gunicorn in the Dockerfile. Sorry if it is a silly question, but did you run docker-compose build before to use docker-compose up?
    – Alexis N-o
    Jul 21, 2015 at 22:12
  • Alexis thanks for response, the reason of using source service it's that I actually have several sites in one django project (container) and source service helps to build them (just shares volumes). And yes I run docker-compose -f docker-compose-prod.yml build before up Jul 22, 2015 at 7:22
  • 1
    Also I'll try again to add RUN pip install gunicorn to the Docker file and rebuild the project, maybe I did something wrong. Jul 22, 2015 at 7:26
  • Try to rethink the whole problem. Using venv inside container is unnecessary as you are already inside isolated environment but lower level and maybe it is the reason. Oct 27, 2015 at 14:28
  • @AlexisN-o docker-compose build fixed it for me. Thanks!
    – nickromano
    May 20, 2016 at 0:16

1 Answer 1

2

The main problem I see is that you're using image: mysitecatalogweb_source for your mysite service, and expecting that to include the committed result of running bin/install, which wasn't actually committed to the mysitecatalogweb_source image -- it's sitting in a container instead, so the virtualenv was never created in the second mysite container, and is thus not activated and gunicorn is not available. From just the snippet here, it appears that you ought to add RUN bin/install to your Dockerfile so that the virtualenv is set up before the attempt to use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.