title: docker-compose and graceful Celery shutdown
body: <p>I've been wondering about and searching for solutions for this and I didn't find any.</p>
  
  <p>I'm running Celery in a container built with docker-compose. My container is configured like this:</p>
  
  <pre><code>celery:
    build: .
    container_name: cl01
    env_file: ./config/variables.env
    entrypoint:
      - /celery-entrypoint.sh
    volumes:
      - ./django:/django
    depends_on:
      - web
      - db
      - redis
    stop_grace_period: 1m
  </code></pre>
  
  <p>And my entrypoint script looks like this:</p>
  
  <pre><code>#!/bin/sh
  # Wait for django
  sleep 10
  su -m dockeruser -c "celery -A myapp worker -l INFO"
  </code></pre>
  
  <p>Now, if I run <code>docker-compose stop</code>, I would like to have a warm (graceful) shutdown, giving Celery the provided 1 minute (<code>stop_grace_period</code>) to finish already started tasks. However <code>docker-compose stop</code> seems to kill Celery straight away. Celery should also log that it is asked to shut down gracefully, but I don't see anything but an abrupt stop to my task logs.</p>
  
  <p>What am I doing wrong or what do I need to change to make Celery shut down gracefully?</p>
  
  <p>edit:
  Suggested answer below about providing the <code>--timeout</code> parameter to <code>docker-compose stop</code> does not solve my issue.</p>