Docker Container开机自动启动
重启策略:
使用在Docker run的时候使用--restart参数来设置。
no - Container不重启
on-failure - container推出状态非0时重启
always - 始终重启
https://docs.docker.com/reference/commandline/cli/#restart-policies
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 theon-failure policy. The default is that Docker will try forever to restart the container.
$ sudo docker run --restart=always redis


This will run the Redis container with a restart policy of always so that if the container exits, Docker will restart it.
$ sudo docker run --restart=on-failure:10 redis


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.
Docker Container开机自动启动的更多相关文章
- Docker容器开机自动启动
部署项目服务器时,为了应对停电等情况影响正常web项目的访问,会把Docker容器设置为开机自动启动. 在使用docker run启动容器时,使用--restart参数来设置: # docker r ...
- 自动启动docker container
当系统启动的时候要启动docker container, 可以利用systemctl来实现 比如拿mongodb为例 创建 /usr/lib/systemd/system/docker_mongodb ...
- 在docker container中运行docker-compose
为了保持宿主主机的环境干净,因此将docker-compose安装到一个基于centos7.3的容器之中,因为tianchao屏蔽了amazonaws,最后选择了通过pip方式来安装,这也是官方推荐的 ...
- Docker实例开机启动
部署项目服务器时,为了应对停电等情况影响正常web项目的访问,会把Docker容器设置为开机自动启动. 在使用docker run启动容器时,使用--restart参数来设置: docker run ...
- linux启动SSH及开机自动启动
本文地址 分享提纲: 1.查看是否启动 2. 设置自动启动 1.[查看是否启动] 启动SSH服务 “/etc/init.d/sshd start”.然后用netstat -antulp | grep ...
- C#中级-开机自动启动程序
一.前言 关于C#开机自动启动程序的方法,网上出现比较多的是修改注册表: 1. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion ...
- 使Docker Container支持运行SWT程序
1, 下载安装JDK的docker container 我是从这个源下载已经做好的JDK8的container: https://registry.hub.docker.com/u/dockerfil ...
- C#.NET Form设置/取消开机自动运行,判断程序是否已经设置成开机自动启动(转载)
#region//开机自动运行 private void CB_Auto_CheckedChanged(object sender, EventArgs e) {//CB_ ...
- linux系统下设置oracle开机自动启动
在Linux系统中,安装好oracle数据库服务后,并不像在Windows系统下一样,oracle服务在默认情况下会随时系统的启动自动启动.Linux系统中,是需要用户去手动进行设置,才能实现orac ...
随机推荐
- c# winform清空ie缓存的几种方法
很明显 IE的缓存在其目录中显示的并不是真正的文件所处的位置,文件的位置是在隐藏的文件夹中,而且这个隐藏的文件夹我们一般找不到.在网上几种清空缓存的方法,在此我一一把代码和处理的效果显示出来.供大家参 ...
- Java注解基础
0.背景 Java注解--Annotation产生于JDK5.作为code的特殊“标记”,注解可以在编译.类加载.运行时被读取,并执行处理. 开发利用注解在源码中嵌入补充信息,工具(代码分析.开发.部 ...
- pytorch函数之nn.Linear
class torch.nn.Linear(in_features,out_features,bias = True )[来源] 对传入数据应用线性变换:y = A x+ b 参数: in_featu ...
- USB Reverse Tether (a dirty solution)
Tether your android phone to your PC using USB cable could share your 3g Internet connection with PC ...
- git命令简单使用
git config --global user.name 'sss' git config --global user.email 'huahua@163.com' cd d:/mywork git ...
- vs2015的密钥
最近一直提示VS要登陆,登陆完就说评估期已到,搞得很烦. VS2015 enterprise版本得密钥: HM6NR-QXX7C-DFW2Y-8B82K-WTYJV 亲测有效!!! 专业版本的 ...
- JS如何按时间粒度获取date的时间差
获取date类型 var type = _xAxis[0].split(/-|:|\s/).length; 按时间粒度获取date的时间差 function getDateDiffByType(new ...
- linux 有了源码创建git版本库(coding)
进入目录,比如ewei_shop 执行 git init 瞬间Git就把仓库建好了,而且告诉你是一个空的仓库(empty Git repository),当前目录下多了一个.git的目录,如果没有看到 ...
- 关于用struts2框架中iframe对应的jsp页面的不到action的值的问题
我们做web项目经常会用到frameset.frame以及iframe,这大大方便了我们页面的构建以及模块功能的划分.但是,再使用这些技术的同时也会遇到各种各样的问题,其中一个就是子页面中得不到str ...
- jQuery实现button按钮提交表单
在JSP页面中,通常使用button按钮提交表单数据,使用jQuery实现代码如下: <span style="font-family:Comic Sans MS;font-size: ...