I have the following container which I've created using the following command:
docker container create --name="my-service" ubuntu:latest sleep 120
When I start docker container start my-service
this container it runs, then exits after 120 seconds, all OK.
Now in a second experiment I start the container, and while it runs I execute:
docker exec -ti my-service /bin/bash
Question
After 120 seconds the interactive bash terminates, because the container itself terminates. Why, and what is exactly the docker engine logic to doing this?