search

Home  >  Q&A  >  body text

centos6.5 - docker 容器状态 困惑

1.系统环境 
centos 6.5(宿主) docker 1.7 centos(6.8 )镜像

2.问题
在查看docker 容器时候发现容器的状态好像有点不同,出现了一点困惑。
docker ps -a 回显信息中的status中:
docker 容器的退出状态出现好多种:
 
exit(0),exit(1),exit(2),exit(127),exit(137)等

只是有一个疑问:在都docker中是否也想linux中执行命令返回码一样,
0代表正常退出。其他代表非正常退出。

有没有详细的说明,解释一下这些退出状态有什么区别吗?

某草草某草草2773 days ago798

reply all(3)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-04-26 09:03:55

    All Docker container runs will specify a running command, which is the startup command of the main process in the container, and the exit code in the container exit status is actually the exit code of this process. In other words, you can directly equate the exit code in Docker with the Linux execution return code.

    reply
    0
  • 世界只因有你

    世界只因有你2017-04-26 09:03:55

    Yes, it is the status code of Linux.


    Appendix:

    http://blog.chinaunix.net/uid...

    The above link is a list of status codes.

    This is the conventional status code, you can see it in /usr/include/errno.h.

    actually

    /usr/include/errno.h  -> 指向下一个文件
    /usr/include/bits/errno.h  ->指向下一个文件
    /usr/include/linux/errno.h  ->指向下一个文件
    /usr/include/asm/errno.h  ->指向下一个文件
    /usr/include/asm-generic/errno.h  -> 35及以后的状态码在这里,同时指向下一个文件
    /usr/include/asm-generic/errno-base.h  -> 34及以前的状态码在这里
    
    

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-04-26 09:03:55

    The status code of docker is not very useful. It means that it runs successfully or if there is a problem after running it, the container is terminated. If docker ps does not come out, it means the operation failed. Sometimes there is a configuration problem when mounting the file, but docker ps -a will come out. It's better to delete it, because next time you use the same container name, there will be a conflict and it will not be started.

    reply
    0
  • Cancelreply