Docker Community Forums

Share and learn in the Docker community.

Possibility for a stop command (executed with docker stop)

docker

(Guenther) #1

It would be nice, to execute custom stop commands when a container is stopped instead of sending the kill command to the process.
This commands could be configured in the Dockerfile with e.g.

ENTRYPOINT ["..."]
EXIT ["..."]

This e.g. is needed when the stop should also clear some resources (pid files, …).

It’s still ok to give the stop command 10 seconds (or more if time is specified) before the container is stopped hard.