Gunicorn doesn’t send exit signal

I try to run my Docker containers: nginx, python and psql. My nginx container depends on python container. But because gunicorn doesn’t send exit signal, nginx container doesn’t get to run.

I tried to change worker types: gevent and eventlet, but still the same.

# docker-compose.yml
version: '2'
services:
  nginx:
    image: nginx:latest
    container_name: ng02
    ports:
      - "8002:8002"
    volumes:
      - ./src:/src
      - ./config/nginx:/etc/nginx/conf.d
      - /static:/static
      - ./src/media:/media
    depends_on:
      - web
  web:
    build: .
    container_name: dg02
    command: bash -c "python manage.py collectstatic --no-input && python manage.py makemigrations && python manage.py migrate && gunicorn --timeout 300 --workers=3 myapp.wsgi -b 0.0.0.0:8002 -k eventlet"
    depends_on:
      - db
    volumes:
      - ./src:/src
      - /static:/static
      - /media:/media
    expose:
      - "8002"

  db:
    image: postgres:latest
    container_name: ps02
# Dockerfile
FROM python:3.6
ENV PYTHONUNBUFFERED 1
RUN mkdir /config
ADD /config/requirements.pip /config/
RUN pip install -r /config/requirements.pip
RUN mkdir /src;
WORKDIR /src

And the output from docker-compose up is as the following:

dg02     | [2019-09-10 07:29:23 +0000] [1] [INFO] Starting gunicorn 19.9.0
dg02     | [2019-09-10 07:29:23 +0000] [1] [INFO] Listening at: http://0.0.0.0:8002 (1)
dg02     | [2019-09-10 07:29:23 +0000] [1] [INFO] Using worker: eventlet
dg02     | [2019-09-10 07:29:23 +0000] [14] [INFO] Booting worker with pid: 14
dg02     | [2019-09-10 07:29:24 +0000] [15] [INFO] Booting worker with pid: 15
dg02     | [2019-09-10 07:29:24 +0000] [16] [INFO] Booting worker with pid: 16

and that’s where the problem is. dg02 doesn’t exist so ng02 doesn’t get to be started. How can I overcome this issue?

Source: StackOverflow