Skip to content

Container doesn't shut down on SIGTERM #50

Description

@Kakoen

The container doesn't listen to SIGTERM, meaning Docker [stop / restart] has to kill it forcefully after waiting 10 seconds (default timeout).

This can either be fixed by prepending the command with 'exec':
CMD exec gunicorn main:app --max-requests 3000 --max-requests-jitter 150 --workers $WORKERS --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:$PORT

Or using exec form (which doesn't work because of the environent variables, you'd have to set the entrypoint to a small .sh script that does the same):
CMD ["gunicorn", "main:app", ...]

See https://lucaspin.medium.com/where-is-my-sigterm-docker-ff7fd8aec757 for more info.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions