-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Graceful shutdown of webservers #33377
Comments
Greetings from one Simon to another. This is a wonderful idea, thanks for opening the feature request! Implementing in #33379. |
Short investigation: Looks like as of today we launch it in a new process group and send SIGKILL to the whole process Group. This can be reflected on that screenshot: We don't know yet why Docker doesn't shut the containers down with that signal. We'd love to make it work for Docker including cc @Skn0tt |
I don't know whether I understand correctly what you mean here. The If you don't want to kill the process immediately but allow it to shut down gracefully, you might take a look at other kill-related signals first: https://unix.stackexchange.com/a/251267/19157 Docker for example when stopping a container first issues |
Some more context from the team call for my own notes:
Sending a |
I've looked into how Docker behaves when the process is killed. Once the
In my testing, i'm seeing 1. happen regardless of wether the client process is shutdown forcefully or with grace. It seems this is implemented inside the Docker daemon, so it works even though the client process isn't around after The 2. works on graceful shutdown, but not when it's forced. I'm assuming that volume removal is implemented in the client. My takeaway from this is that we should give the There's no easy way for us to detect if a process respects 500ms is short, but should be enough for most local dev servers I believe. For dev servers that don't respect |
When you |
To illustrate the above, try the following: In services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: test Now run
Repeat the test, and you'll see that the container got cleaned up correctly. |
I found another resource confirming that To the Postgres will stop when receiving I don't know by heart which process is a child of a That said, it's probably best to call a
|
🚀 Feature Request
I want a graceful shutdown for webservers (the process should be sent a
SIGINT
signal).Example
No response
Motivation
For my e2e testing, which are full system tests, I want to spin up the frontend, backend and a database. For the database I want to use a command like
docker run --rm -a stdout -a stderr --name ecorize-e2e-db -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 postgres
.The current approach of killing the process has the downside that the clean-up action cannot be executed (https://docs.docker.com/reference/cli/docker/container/run/#rm).
I'm currently using
concurrently
to realize this. The downside there is that it's harder for me to set up different environment variables per process.The text was updated successfully, but these errors were encountered: