I'm using different Docker images to run code and noticed the following:
$ time sudo docker stop $(sudo docker run -dit --rm centos:latest)
509285200bcf4ea8389219319b6c4af6554abf9f1c9d9ffb152cd109b6a21453
real 0m1,374s
user 0m0,087s
sys 0m0,027s
$ time sudo docker stop $(sudo docker run -dit --rm debian:latest)
221221b4b9238de633ca68d9539b024c06d015ea503a8b7fd5b827dc903193b8
real 0m1,345s
user 0m0,086s
sys 0m0,034s
$ time sudo docker stop $(sudo docker run -dit --rm ubuntu:latest)
5512fb2505f28f7d2a52788a2ed9775c78ae40805da44e51bb3f22073133f19c
real 0m1,341s
user 0m0,075s
sys 0m0,048s
$ time sudo docker stop $(sudo docker run -dit --rm alpine:latest)
dc1775fa2734c753a5ba6f3fc0b14bf356376d8c701fcf6efa637f1795f41b4a
real 0m11,439s
user 0m0,089s
sys 0m0,032s
How can this difference be explained?
Update: The time difference is solely produced by docker stop
. If I extend the timeout with docker stop -t 30
for example, the alpine
container takes all of that time and eventually times out, while the behavior of the other containers is naturally not affected by the increased timeout. This seems to have something to do with the propagation of SIGTERM - I can find some previous issues on this, but they are about docker stop
in general and not regarding alpine
explicitly. This doesn't explain why the issue exists for alpine
and not for the other images.