Keep Docker Running
Many times we need dockers containers to keep running after they are started started either by using a docker run / docker exec / docker-compose
command or while running as a kubernetes
pod.
The following are a few of the command we can use to achieve the same:
sleep inf
tail -F /dev/null
These commands need to run as the first thing that these dockers run. So they go as the entrypoint
. Or if you want flexiblity you can add them as command
, but ensure that the entrypoint know how to run these.
These can also be passed directly to the docker run
command, and later you can start a bash terminal using docker exec
(instead of starting bash/sh in docker run
and the using docker attach
)
Keep Docker Running