0

Good friends, I am developing an application in django 1.11 with docker on windows, recently update the git repository of the project and also made some changes with docker containers.

The problem is that when entering the main page and some other URLS nothing happens, but when I try to login to the administrator, the django container is closed and I do not even get any error by the browser, console or log .

Example:

When I come in here they are fine

GET / 200 OK
POST / 403 Forbidden
GET / api / auth / 405 Method not allowed

But when I enter these, without showing any message, close the docker container (proyect_django_1 exited with code 0)

GET / admin No answer
POST / api / auth / No answer

My docker-compose

version: '3' services: db: build: docker/postgres volumes: - ./docker/data/postgres:/var/lib/postgresql/data environment: - POSTGRES_PASSWORD=postgres - POSTGRES_USER=postgres - POSTGRES_DB=project redis: image: redis:3.2-alpine volumes: - ./docker/data/redis:/data rabbit: image: rabbitmq:3-management-alpine environment: - RABBITMQ_DEFAULT_USER=admin - RABBITMQ_DEFAULT_PASS=admin django: build: context: . args: - REQUIREMENTS=development.txt command: python3.6 manage.py runserver 0.0.0.0:8008 volumes: - ./:/code working_dir: /code/project env_file: ./docker/DevelopmentEnv ports: - "8008:8008" links: - db - rabbit - redis depends_on: - db celeryworker: build: context: . args: - REQUIREMENTS=development.txt working_dir: /code/project volumes: - ./:/code env_file: ./docker/DevelopmentEnv links: - db - rabbit command: celery -A config worker -l INFO -Q celery frontend: image: node:8.4-alpine volumes: - ./:/code working_dir: /code/frontend command: ash -c "yarn install --no-bin-links && yarn run build" socketio: image: node:8.4-alpine volumes: - ./:/code working_dir: /code/sockets command: ash -c "yarn install --no-bin-links && yarn start" ports: - "3000:3000" links: - redis - django depends_on: - redis 

My dockerfile

FROM python:3.6.2-alpine3.6 ARG REQUIREMENTS RUN apk update RUN apk add postgresql-dev postgresql-client RUN apk add libffi-dev gcc RUN apk add musl-dev zlib-dev jpeg-dev RUN apk add --no-cache --virtual .build-deps-testing \ --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \ gdal-dev RUN mkdir /code ADD ./ /code/ WORKDIR /code RUN pip3.6 install -r requirements/$REQUIREMENTS WORKDIR /code/project 
3
  • Post your Dockerfile and other details Commented Aug 24, 2017 at 14:48
  • what command are you running to start the app? There is no CMD section inside your Dockerfile. Your container will exit instantly when running. Commented Aug 24, 2017 at 15:11
  • The container if it runs, and it responds to me several urls without problems, but others do not. The command I ran to run all the containers is docker-compose up Commented Aug 24, 2017 at 15:27

1 Answer 1

1

You could add restart: always to your django service definition. This will start a new django container if the previous one exits for any reason.

You should be getting some logs about why the process is exiting. Try running docker inspect <container-name> to see if there are any clues about why the process exits. There is probably a bug in your Python code triggered by some URLs, and it causes the process to exit.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.