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 ...
随机推荐
- Window Redis安装
1.下载redis 下载地址:https://github.com/MicrosoftArchive/redis/releases 2. 安装redis 把下载的Redis-x64-3.2.100 ...
- BBS配置
BBS配置 一.url路由 """BBS URL Configuration The `urlpatterns` list routes URLs to views. F ...
- Matlab高级教程_第四篇:Matlab高级函数_关键词:drawnow,addpoints,animatedline,getpoints
0. MATLAB真实航母基本的工具,其中的函数/工具不计其数,而且有些函数/工具非常的炫酷.在MATLAB第四篇章把平时工作中用到的些许函数进行使用的讲解 主题1.:drawnow 解释:更新图窗并 ...
- Windows、Linux(Ubuntu)修改 pip 镜像源
一.Windows 修改 pip 镜像源 1.win + R 打开运行,输入 %APPDATA% 2.按下回车,打开文件夹. 3.在该文件夹下,新建文件夹,命名 pip. 4.进入 pip 文件夹, ...
- 磁力搜索导航,MagnetW将搜索结果格式化统一显示
简介 magnetW基于magnetX的规则原理,将各个磁力站的搜索结果统一格式化 安装 从Github Releases或者Github Wiki下载对应平台 3.1.1 更新了一批规则 支持Soc ...
- i春秋web作业2.26
Web安全工程师(入门班) [全国线上入门班53期]课后作业 2020-2-26 DorinXL 1)为什么说js校验是一种不安全的校验方式? js校验不安全,是因为用户很容易通过控制台删除或 ...
- C++ lock_guard 互斥锁
概述根据对象的析构函数自动调用的原理,c++11推出了std::lock_guard自动释放锁,其原理是:声明一个局部的lock_guard对象,在其构造函数中进行加锁,在其析构函数中进行解锁.最终的 ...
- 903A. Hungry Student Problem#饥饿的学生(暴力&双层枚举)
题目出处:http://codeforces.com/problemset/problem/903/A 题目大意就是:一个数能否用正整数个另外两个数合成 #include<iostream> ...
- pycharm、Django+node.js、vue搭建web项目
参考文章:https://www.wandouip.com/t5i35466/ 在此感谢 本篇接着上一篇:windows10使用npm安装vue.vue-cli 首先Django项目是搭建好的,就是 ...
- Sqlite教程(3) SQlite Query
Configuration是属於util工具包. 把所有环境设置都定义在Configuration工具包里,那麽这个Configuration就是独立的单一入囗. 在架构上,可以提高耦合度,而且出Bu ...