繁体   English   中英

Ubuntu docker 映像未在分离模式下运行

[英]Ubuntu docker image is not running in the detached mode

我使用下面的 Dockerfile创建了一张图片

FROM ubuntu:latest
RUN mkdir -p /app   
COPY . /app         
CMD python /app/app.py

我正在使用这个命令来构建图像:

DOCKER_BUILDKIT=1 docker build -t my-first-ubuntu-image .

而这个运行容器

Command for running the container : docker container run -d my-first-ubuntu-image

当我运行docker ps -a*时,它的状态显示为Exited
到底是怎么回事? 我无法理解,因为当我对nginx图像执行相同操作时,它正在running state。

有一个技巧可以防止容器死机: docker run -d my_image -d tail /dev/null -f

命令tail /dev/null -f使容器永远忙碌。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM