有没有一种在Ubuntu 14.04上执行此操作的首选方法?
我过去曾使用supervisord自动启动网络应用程序.但这对Docker来说并不合适.
sudo docker run --restart=always -d myimage
文档摘录
Restart Policies Using the –restart flag on Docker run you can
specify a restart policy for how a container should or should not be
restarted on exit.no – Do not restart the container when it exits.
on-failure – Restart the container only if it exits with a non zero
exit status.always – Always restart the container regardless of the exit status.
You can also specify the maximum amount of times Docker will try to
restart the container when using the on-failure policy. The default is
that Docker will try forever to restart the container.06001
This will run the redis
container with a restart policy of always so that if the container
exits,Docker will restart it.06002
This will run the redis container with a restart policy of on-failure and a maximum restart count of 10. If the redis container exits with a non-zero exit status more than 10 times in a row Docker will abort trying to restart the container. Providing a maximum restart limit is only valid for the on-failure policy.
原文地址:https://www.jb51.cc/ubuntu/349079.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。