Skip to content

Container doesn't shut down on SIGTERM #50

@Kakoen

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.

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