Solution for docker to exit as soon as it starts

docker run -d -p3308:3306 docker.io/vinodapplift/centos-mysql5.7 sh -c 'service mysqld start && while true; do echo hello world; sleep 1; done'

Mainly this sentence shell, let this container always execute a task, will not exit the container because there is no task
* && while true; do echo hello world; sleep 1; done'*

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324479789&siteId=291194637