I'm quite new to Docker. I'm trying to run Django on Docker. Following is my docker-compose file.
version: '2' services: django: build: context: . dockerfile: ./deploy/dev/Dockerfile tty: true command: python manage.py runserver 0.0.0.0:8000 ports: - "8000:8000" volumes: - ./app:/src/app depends_on: - "workflow_db" - "rabbitmq" env_file: - ./deploy/dev/envvar.env workflow_db: image: postgres:9.6 volumes: - postgres_data:/var/lib/postgresql/data/ environment: - POSTGRES_USER=hello_django - POSTGRES_PASSWORD=hello_django - POSTGRES_DB=hello_django rabbitmq: image: "rabbitmq:3-management" hostname: "rabbitmq" environment: RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG" RABBITMQ_DEFAULT_USER: "rabbitmq" RABBITMQ_DEFAULT_PASS: "rabbitmq" RABBITMQ_DEFAULT_VHOST: "/" ports: - "15672:15672" - "5672:5672" volumes: postgres_data: DockerFile
FROM python:3.7-alpine RUN apk update && apk add --no-cache gcc libffi-dev g++ python-dev build-base linux-headers postgresql-dev postgresql postgresql-contrib pcre-dev bash alpine-sdk \ && pip install wheel #Copy over application files COPY ./app /src/app #Copy over, and grant executable permission to the startup script COPY ./deploy/dev/entrypoint.sh / RUN chmod +x /entrypoint.sh WORKDIR /src/app #Install requirements pre-startup to reduce entrypoint time RUN pip install -r requirements.txt ENTRYPOINT [ "/entrypoint.sh" ] And finally my entrypoint.sh
#! /bin/bash cd /src/app || exit echo "PIP INSTALLATION" && pip install -r requirements.txt echo "UPGRADE" && python manage.py migrate # echo "uwsgi" && uwsgi "uwsgi.ini" I do django-compose build, it builds the image. But when I do docker-compose up django_1 exited with code 0.
However, if I uncomment the last line of entrypoint.sh, it runs perfectly well.
Can someone help me understand the reason behind it?
/src/app/app/.... as the application exiting with code 0 so mean no erro, one thing that help you to debug by addingdjango: command: tail -f /dev/nullthen verify files and folder inside django container. seems like something wrong with pathdjango_1 exited with code 0? And could you include youruwsgi.iniinto the question?