dockerd: adjust shutdown timeout to allow graceful shutdown of containers
Nobody has claimed this yet.
- Dominant language
- Makefile
- Stars
- 4.6k
- Forks
- 4k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 134
Description
Maintainer: @G-M0N3Y-2503
By default procd has a shutdown timeout of 5 seconds, procd initially sends a SIGTERM kill signal to allow docker service to shutdown gracefully, after waiting 5 seconds, if the service is still running, it will send a SIGKILL signal forcing the service is shutdown forcefully and immediately without consideration even if the container is still writing a a file to the disk.
This behavior often causes severe data corruption and partial writes, especially for Database services like mysql, postgres, influxdb, prometheus (tsdb), SQLite-based services, etc. This becomes a major issue especially when you're frequently restarting your device/computer (x86).
I'd like to propose increasing the term_timeout in procd for docker service to at least 5 minutes AND allowing the configuration of shutdown-timeout in daemon.json through UCI.
Proposed changes in /etc/init.d/dockerd
in start_service()
procd_set_param term_timeout 300 # e.g. 5 minutes to wait for shutdown
in process_config()
...
config_get shutdown_timeout globals shutdown_timeout ""
...
json_add_int "shutdown-timeout" "${shutdown_timeout}"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with /etc/init.d/dockerd, especially start_service() and process_config(), and read how procd service parameters and UCI globals are handled there. Implement the requested 300-second term_timeout and daemon.json shutdown-timeout configuration, then verify the generated Docker configuration and service shutdown behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, shell
- Domain
- devops, infrastructure
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100