For #2, i’m going to use “docker exec” to start a new command in the existing container? Will container exit although “docker exec” command is still running?
If you are using docker exec to run sleep as a new command in a running container even if the sleep command exits the container wont exit. The containers lifetime is determined by the command which was used to start the container(Process ID 1 in the container) and not on any other process that runs/exits in between.