Verify the container was created and then stopped:

The important bit here is the STATUS output which says it stopped with an exit code of 1. That’s the generic exit code for an error. Typically every code other than 0 is considered an error. 0 means the program stopped correctly without errors.

This is useful to know in the real world because if you’re writing your own scripts, you can automate things based on whether or not a container stopped successfully or not.

You can even get the exit code without any extra cruft by running docker inspect 61c6 --format='{{.State.ExitCode}}'. That’s perfect for scripts because you can check the code easily.

Free Intro to Docker Email Course

Email Address

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.