如何不通过Dockerfile从已有镜像构建新镜像
大家讲道理
大家讲道理 2017-04-26 09:01:33
0
2
702

例如,我用docker hub的Debian官方镜像创建了一个容器,然后进入容器update了一番,然后又部署了一个nginx服务,并在rc.local里设置自启,之后退出容器并将该容器commit了一个新镜像A。之后我尝试从A镜像启动一个容器却发现启动失败了,docker run -ddocker ps里没有该容器,docker run -it后退出容器后容器随之也关闭了。请问这是什么原因呢?求解答谢谢。
Dockerfile用得还不是很应手。

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
伊谢尔伦

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template