Services and User Management

A container named app01 exited unexpectedly overnight. An administrator wants only its exit code to decide how to proceed. Which command returns that value?

Show the answer

Correct answerA. docker inspect -f '{{.State.ExitCode}}' app01

docker inspect with a Go template on .State.ExitCode prints the stored exit status of a stopped container. docker logs shows only the output the process wrote, which may not contain the code, and docker top only works on running containers.