0

According to the docs:

  • docker stop <containerName> will send a SIGTERM to the main process inside the container
  • docker kill -s <signal> <containerName> will send an arbitrary signal to the main process inside the container.

This suggests to me that docker stop is equivalent to docker kill -s term.

However, that's not the case. When I use docker kill -s term, my application receives a SIGTERM and exits gracefully. But when I use docker stop, my application receives no signals, and after the 10-second timeout Docker will force kill the process.

What could explain this different behavior?

1 Answer 1

0

It turns out that the docs are incomplete in this area. docker stop won't always send a SIGTERM. If there is a different 'stop signal' configured in the image metadata, it will send that signal instead.

In my case, the parent image I had built upon contained this line in its Dockerfile:

STOPSIGNAL SIGQUIT

So Docker would send a SIGQUIT instead of a SIGTERM whenever you call stop.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .