It would be nice to be able to specify the timeout for docker-compose up
, docker-compose stop
docker-compose restart
in the service definition. Something like a "stop_timeout" key.
I agree that it might be nice to set a global stop timeout, but it feels like the kind of configuration - like the project name - that shouldn't be tied to docker-compose.yml
, but instead should go in something non-versioned like a dotfile.
I thought maybe different projects have different shutdown timeout requirements, so in my head it would be tied to a single docker-compose.yml.
Also, different services could need different timeout requirements but in that case you could just set it up for the "slowest shutdown service" among them.
I am interested in this too!
We've implemented a -t
to set a timeout from the command line.
Could you tell us more about any cases where a single timeout won't work?
Even if you have to set the value to a larger value, now that we do shutdown in parallel, I think it should be fine to set a single timeout per command.
@dnephin right now it is solved!
Hi,
I would like to add the option -t on the yml file (docker compose v2). Because the people of validation do not usually manipulate docker compose parameters.
@lwalid: you may be looking for stop_grace_period
https://docs.docker.com/compose/compose-file/compose-file-v2/#stop_grace_period
@dnephin, the use-case where we would want this in docker-compose.yml is as follows. If we have a large database like SQL Server, a SIGKILL could be a very bad thing leading to a huge rebuild of databases. We want to ensure that this never happens. Specifying the timeout in the yml file would prevent us from accidentally forgetting the -t option when shutting down the compose group.
Bottom line: if a SIGKILL is a terrible thing for one of the services, then we don't want the human operator to have to remember to extend the timeout.
Oops. Perfect, that’s what I need, thank you for the help.
On Jul 19, 2018, 11:38 AM -0700, Daniel Nephin notifications@github.com, wrote:
https://docs.docker.com/compose/compose-file/#stop_grace_period
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
stop_grace_period does seem to work with docker-compose stop, but is it acually used with "docker-compose down"?
Most helpful comment
@lwalid: you may be looking for
stop_grace_period
https://docs.docker.com/compose/compose-file/compose-file-v2/#stop_grace_period