In order to keep the docker container running, do you want to write a dead-loop program?

  docker, question

In order to keep the docker container running, do you want to write a dead-loop program?
I want the container to run all the time.

You can do this

CMD tail -f /var/log/cron.log

Run a task with continuous output in DockerFile
Well, this is almost a dead cycle.

docker ps -a

图片描述
You can see the operating status of the docker here. up is running all the time, and exit is exiting after running. Docker will exit after running the task you want it to perform. So you have to write a continuous command.