question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Taking a long time for Docker container to stop

See original GitHub issue
$ time docker stop py-kms
py-kms

________________________________________________________
Executed in   10.21 secs      fish           external
   usr time   15.06 millis    0.00 micros   15.06 millis
   sys time    6.14 millis  282.00 micros    5.86 millis

Maybe the stop signal is incorrect or needs to be setup properly in the application code?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
PAI5REECHOcommented, May 6, 2022

It never actually succeeds in stopping the container at all. It’s waiting 10 seconds for a graceful stop (which never happens) and then it’s sending the container the kill signal:

The main process inside the container will receive SIGTERM, and after a grace period, SIGKILL.

As also noted in the Docker documentation the default waiting period is 10 seconds (which is what I’m observing as the time it takes to stop the container):

Name, shorthand Default Description
--time , -t 10 Seconds to wait for stop before killing it
0reactions
PAI5REECHOcommented, May 12, 2022

Seems fixed now:

$ time docker stop py-kms
py-kms

________________________________________________________
Executed in  167.77 millis    fish           external
   usr time   20.98 millis    0.00 micros   20.98 millis
   sys time    5.98 millis  254.00 micros    5.72 millis
Read more comments on GitHub >

github_iconTop Results From Across the Web

It takes too long to shut down the Docker container
The default number of seconds the docker container stop <container_name> command will wait before the killing is 10 seconds. Share.
Read more >
The Reason Why You Need to Wait When Stopping Your ...
Docker has limited patience when it comes to stopping containers. There's a timeout, which is 10 seconds by default for each container. If...
Read more >
Docker takes a really long time to start / stop containerized ...
The time spent seems to be very CPU bound, and we're talking about upwards of 6+ seconds to start and stop a container...
Read more >
Fix slow container shutdown - donchev.is
Add STOPSIGNAL SIGINT to your Dockerfile (this is a quick & dirty solution and only takes care of one edge case and shouldn't...
Read more >
Why Does My Docker Container Stop? - Tutorial Works
When you run a container image you've pulled from a registry like Docker Hub, you're launching a process. This process will, eventually, complete....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found