Container exit codes and restart policies
You can specify the so called restart policy using the
--restart switch with the
docker run command. Restart policy tells Docker how to behave on container shutdown. It can be restarted to minimize downtime, for example if running on production server. However, before we explain the Docker restart policy, let's focus on the exit codes. The exit code is crucial information, it tells why the container failed to run or why it exited. Sometimes it's related to the contained command you will give to
docker run as a parameter.
dockerrun command ends with a non-zero code, the exit codes follow the
chroot standard, as you can see in the following example:
- exit code
docker runcommand fails by itself ...