What is the use of “docker wait” commands? with example and image

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Block until one or more containers stop, then print their exit codes.

Example:

Terminal 1:

root@ip-172-31-28-155:/home/ubuntu# docker wait test_su1

Terminal 2:

root@ip-172-31-28-155:/home/ubuntu# docker stop test_su1

Terminal 1:

root@ip-172-31-28-155:/home/ubuntu# docker wait test_su1
0