Docker-容器未运行 [英] Docker - Container is not running

查看:521
本文介绍了Docker-容器未运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全是Docker的新手。我试图启动一个如下所示的退出容器,

I'm completely a newbie to docker. I tried to start a exited container like follows,


  1. 我使用 docker ps -a列出了所有可用的容器。它列出了以下内容:

  1. I listed down all available containers using docker ps -a. It listed the following:

我输入了以下命令来启动处于退出阶段的容器,然后进入该图像的终端。

I entered the following commands to start the container which is in the exited stage and enter into the terminal of that image.

docker start 79b3fa70b51d
docker exec -it 79b3fa70b51d /bin/sh



  • 它引发以下错误。

  • It is throwing the following error.

    FATA [0000]守护程序的错误响应:容器79b3fa70b51d未运行

    但是当我使用 docker启动79b3fa70b51d 启动容器时。如果一切正常,它将容器ID作为输出输出。我不确定导致此错误的原因。关于原因的任何想法和建议对我将大有帮助。

    But when I start the container using docker start 79b3fa70b51d. It throws the container ID as output which is normal if it have everything work normally. I'm not sure what causes this error. Any idea about the causes and suggestions about this would be greatly helpful for me. Thanks in advance.

    推荐答案

    容器 79b3fa70b51d 似乎只能做一个 echo

    这意味着它开始,回显然后立即退出。

    That means it starts, echo and then exits immediately.

    下一个< a href = http://docs.docker.com/reference/commandline/cli/#exec rel = noreferrer> docker exec 命令找不到它正在运行以将其自身附加到该容器并执行任何命令:为时已晚。容器已经退出。

    The next docker exec command wouldn't find it running in order to attach itself to that container and execute any command: it is too late. The container has already exited.


    docker exec 命令在运行的容器中运行新命令。

    The docker exec command runs a new command in a running container.

    使用 docker exec 启动的命令仅在容器的主进程(PID 1)运行时运行

    The command started using docker exec will only run while the container's primary process (PID 1) is running

    这篇关于Docker-容器未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆