When deploying the project server, the Docker container will be set to start automatically when power on, in order to cope with the power failure and other conditions that affect the access of normal web projects.
When starting a container with docker run, use the --restart parameter to set:
# docker run -m 512m --memory-swap 1G -it -p 58080:8080 --restart=always --name bvrfis --volumes-from logdata mytomcat:4.0 /root/run.sh
--restart specific parameter value details:
no - do not restart the container when the container exits;
on-failure - only restart the container if it exits with a non-zero status;
always - restart the container regardless of exit status;
You can also specify the maximum number of times Docker will try to restart the container when using the on-failure strategy . By default, Docker will try to restart the container forever.
# sudo docker run --restart=on-failure:10 redis
If --restart=always is not specified when creating, you can pass the update command
docker update --restart=always xxx
https://blog.csdn.net/lin521lh/article/details/78413631
http://neo-it.iteye.com/blog/2291750