How docker service checks if container is up

Hi :slight_smile:

When i start a service, it creates container. If i remove this container, it is recreated immediately :

$ docker service create debian tail -f /dev/null
$ docker ps -a
COMMAND                CREATED           STATUS       NAMES
"tail -f /dev/null"    4 seconds ago     Created      goofy_bell.1.y1huse6oonnfuzsw7j61wpoza
$ docker rm -f goofy_bell.1.y1huse6oonnfuzsw7j61wpoza
$ docker ps -a
COMMAND                CREATED           STATUS       NAMES
"tail -f /dev/null"    3 seconds ago     Created      goofy_bell.1.znljwpd6gdsxrh1k1gui1jd08

I would like to understand how docker service checks container status, and how it determines if it has to start a new container or not.

Thank you :slight_smile: