PID 1 in Linux gets no default signal handlers, so a shell script as the entrypoint ignores SIGTERM entirely and docker stop waits ten seconds before killing it.
$ time docker-compose stop php
real 0m10.412s # the grace period, every time
# the one-character fix in a script:
# exec "$@"
# and for anything that forks children:
$ docker run --init app # tini as PID 1, and it reaps zombies
The exec is easy to omit and its absence costs ten seconds per container per deploy, which on a stack of seven is over a minute of every release. --init covers the harder case where the process legitimately forks and nothing reaps the children, which presents as a container slowly accumulating zombie processes over days. Neither is a performance question so much as a correctness one: a killed process does not finish what it was doing.