Debug School

aswinp.achutham90@gmail.com
aswinp.achutham90@gmail.com

Posted on

Docker wait command

Docker wait command waits till the container stops and returns the exit codes.

Eg:

  1. Start a container in terminal 1.
    [root@localhost /]# docker run -dit --name=my_container ubuntu bash
    6eeb1f587cebdb3c4e9c071b4794a25f17c41c7afa4b1119967eb9d0775875f1
    [root@localhost /]# docker wait my_container

  2. In another terminal stop the container my_container created in terminal1.
    [root@localhost ~]# docker stop my_container
    my_container

  3. In terminal 1 you will notice the wait command returns the exit code:
    [root@localhost /]# docker wait my_container
    137

Top comments (0)