docker run centos 的时候会发现容器启动就停止了,那么我们可以这样运行:
docker run -d centos tail -f /dev/null或者这样:
docker run -d centos sleep infinity如果你是用docker-compose的方式运行,帮
tail -f /dev/null 或者 sleep infinity放到 cmd参数里面就行了。参考资料:
https://stackoverflow.com/questions/30209776/docker-container-will-automatically-stop-after-docker-run-d
> 6 Best Ways to Keep Docker Container Running For Debugging