例如,我用docker hub的Debian官方镜像创建了一个容器,然后进入容器update了一番,然后又部署了一个nginx服务,并在rc.local里设置自启,之后退出容器并将该容器commit了一个新镜像A。之后我尝试从A镜像启动一个容器却发现启动失败了,docker run -d后docker ps里没有该容器,docker run -it后退出容器后容器随之也关闭了。请问这是什么原因呢?求解答谢谢。 Dockerfile用得还不是很应手。
A container needs a service to run in order to run, and it is officially recommended that a container only run one service
All Dockerfiles are followed by CMD or ENTRYPOINT. If you want to run your image in the background, just follow run -d with a persistent command or program
A container needs a service to run in order to run, and it is officially recommended that a container only run one service
All Dockerfiles are followed by CMD or ENTRYPOINT. If you want to run your image in the background, just follow run -d with a persistent command or program
Yes! But your nginx service runs in the foreground of the container. Do not add it to the system’s services