Docker wait command waits till the container stops and returns the exit codes.
Eg:
Start a container in terminal 1.
[root@localhost /]# docker run -dit --name=my_container ubuntu bash
6eeb1f587cebdb3c4e9c071b4794a25f17c41c7afa4b1119967eb9d0775875f1
[root@localhost /]# docker wait my_containerIn another terminal stop the container my_container created in terminal1.
[root@localhost ~]# docker stop my_container
my_containerIn terminal 1 you will notice the wait command returns the exit code:
[root@localhost /]# docker wait my_container
137
Top comments (0)