The software described in this documentation is either no longer supported or is in extended support.
Oracle recommends that you upgrade to a current supported release.

4.2.1 Configuring How Docker Restarts Containers

To specify how you want Docker to handle a container when it exits, you can use the --restart option with docker run in version 1.2.0 and later of Docker and with docker create in version 1.3.0 and later:

--restart=always

Docker always attempts to restart the container when the container exits.

--restart=no

Docker does not attempt to restart the container when the container exits. This is the default policy.

--restart=on-failure[:max-retry]

Docker attempts to restarts the container if the container returns a non-zero exit code. You can optionally specify the maximum number of times that Docker will try to restart the container.