docker wait
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
blocks container and when container is stop ,it prints their exit code
[root@ip-172-31-4-255 centos]# docker run -dit –name=my_container ubuntu bash
dcd196da19b9c9b356597efa55b442fe0479f7c4f66d6dcf6745fab0995a64eb
[root@ip-172-31-4-255 centos]# docker wait my_container
in duplicated terminal
[root@ip-172-31-4-255 centos]# docker stop my_container
my_container
in previous terminal
[root@ip-172-31-4-255 centos]# docker wait my_container
0