gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 19:48:11 24 4
gpt4 key购买 nike

我使用以下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状态。

最佳答案

有一个防止容器死亡的技巧:docker run -d my_image -d tail /dev/null -f
命令tail /dev/null -f使容器永远处于繁忙状态。

关于docker - Ubuntu docker镜像未在分离模式下运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62372300/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com