gpt4 book ai didi

docker - 容器的 “dead”状态是什么?

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

https://docs.docker.com/engine/reference/commandline/ps/

status One of created, restarting, running, removing, paused, exited, or dead



“死”状态对容器意味着什么?
  • “已死”是指容器已被docker rm删除了吗?
    那么docker ps --all是否不会显示已死容器?
  • “死”是指"A container that the daemon tried and failed to stop (usually due to a busy device or resource used by the container)"吗?我还没有发现那是哪里来的。我不确定这是否正确,因为“停止失败”是否可以表示容器正在运行?

    “exited”还意味着"A container that ran and completed"吗?如果容器由于错误而在完成前退出,那么它的状态是什么?
  • 最佳答案

    只要看一下文档,我就会发现:

    "dead" is used for a "defunct" container; for example, a containerthat you wanted to remove but was only partially removed becauseresources were kept busy by an external process. Dead containerscannot be (re)started, only removed. You can manually attempt toremove a dead container (if the problem causing it to not be removedin the first attempt failed), and the daemon will automaticallyattempt to remove dead containers when it's restarted.


    来自Docker维护者Sebastiaan van Stijn, https://github.com/docker/cli/issues/502#issuecomment-330361748
    那是一个很权威的信息,所以看起来您链接到的Stackoverflow答案确实是正确的。

    Does "dead" mean that the container has been removed by docker rm ?


    docker rm已执行,但仅部分成功,因此仍处于 dead状态。
    是的,它们会以ps显示--all:

    While reviewing the output of docker ps -a you may have seen both deadand exited statuses for containers. https://success.docker.com/article/what-is-the-difference-between-dead-and-exited-containers

    If a container exits before completion due to error, what is itsstatus?


    其状态为“已退出”,并返回错误代码,例如“10秒前退出(1)”。 https://success.docker.com/article/what-is-the-difference-between-dead-and-exited-containers

    Does "exited" mean "A container that ran and completed"?


    是的,状态包括主进程的退出状态代码。

    关于docker - 容器的 “dead”状态是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55526915/

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