Skip to content

container that ran a command and exited still listed as running #257

Closed

Description

@bbangert

To replicate:

root:~# docker run base /bin/echo hello world                                                                 2013/03/29 16:52:07 docker run base /bin/echo hello world
hello world
root:~# docker ps
2013/03/29 16:52:13 docker ps
ID          IMAGE       COMMAND     CREATED     STATUS      COMMENT
root:~# docker ps -a
2013/03/29 16:52:15 docker ps -a
ID                                                                 IMAGE         COMMAND                CREATED         
STATUS      COMMENTb471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731   base:latest   /bin/echo hello worl   8 seconds ago   
Exit 0      
root:~# docker start b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731
2013/03/29 16:52:21 docker start b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731
b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731
root:~# docker logs b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731
2013/03/29 16:52:26 docker logs b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731
hello world
root:~# docker ps
2013/03/29 16:52:27 docker ps
ID                                                                 IMAGE         COMMAND                CREATED         
 STATUS         COMMENTb471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731   base:latest   /bin/echo hello worl   20 seconds ago  
 Up 6 seconds   
root:~# docker stop b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731
2013/03/29 16:52:38 docker stop b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731
2013/03/29 16:52:38 lxc-kill: 'b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731' is not running
lxc-kill: failed to get the init pid
2013/03/29 16:52:38 Failed to send SIGTERM to the process, force killing
2013/03/29 16:52:48 Container b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731 failed to exit within 10 seconds of SIGTERM - using the force
b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731
root:~# df
Filesystem     1K-blocks    Used Available Use% Mounted on

none           114871816 2175800 106860808   2% /var/lib/docker/containers/b471a5ea0aeb1c33ef0a6a600f2cb6e675372e1138bde5f439a0de3c832ea731/rootfs

The JSON for this container thinks its running, it is not running though, the command exited. This occurs whether in standalone mode or daemon.

Activity

  1. bbangert commented on Mar 29, 2013

    @bbangert
    Author

    This is probably related to Issue #109.

  2. creack commented on Mar 31, 2013

    @creack
    Contributor

    The issue occurs only in stand alone mode.

    When doing 'start', as docker will not wait for the process to finish and leave, the process is nerver marked as 'stopped'.

    We need a better check of the status of containers when docker starts. Will do that now :)

    It might also be nice to add a 'wait' option to docker start? or to be aware that we are in standalone mode.
    @shykes any thoughts?

  3. ghost assigned on Apr 1, 2013
  4. creack commented on Apr 1, 2013

    @creack
    Contributor

    I fixed the issue by adding a better check of the running state in runtime.restore().
    I still need to add unit tests and I'll push

  5. added 2 commits that reference this issue on Apr 1, 2013
    b31b898
    f364ac4
  6. ghost assigned on Apr 2, 2013
  7. added a commit that references this issue on Jun 18, 2019
  8. added a commit that references this issue on May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions