How to do it...

You can set the restart policy using the following syntax:

    $ docker container run --restart=POLICY [OPTIONS] IMAGE[:TAG]  [COMMAND] [ARG...] 

Here is an example of using the preceding command:

    $ docker container run --restart=always -d -i -t ubuntu /bin/bash

There are three restart policies to choose from:

  • no: This does not start the container if it dies
  • on-failure: This restarts the container if it fails with a nonzero exit code
  • always: This always restarts the container without worrying about the return code
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.207.113