[Docker] Ensure Containers Run with High-Availability
Docker with run High Containers Availability ENSURE
2023-09-14 08:59:13 时间
A properly scaled Docker architecture should be able to kill off random containers at any time, and continue to run by implementing a crash-only design methodology. We will learn how to setup our architecture to auto-spawn new Docker containers when other containers are deemed unhealthy or in a terminated state. We will also learn how to scale containers easily with Compose in the event we need to quickly scale horizontally.
For example we have a nodejs image called helloworld:
Dockerfile:
FROM mhart/alpine-node COPY index.js . CMD node index.js
To ensure high availablity, we can pass --restart:
docker run --restart always --name test helloworld
Another way is using docker-compose.hml:
version: '3'
services:
helloworld:
image: helloworld
restart: always
Run:
docker-compose up --scale helloworld=3 ## 3 instants
index.js
console.log('hello world');
setTimeout(() => process.exit(), 3000);
相关文章
- 【Docker异常】ERROR: dial unix docker.raw.sock: connect: connection refused
- 【Docker】docker安装Jenkins
- Play with docker 1.12
- [Docker] Build a Simple Node.js Web Server with Docker
- Linux高级运维 第八章 部署docker容器虚拟化平台
- Docker - 搭建私有仓库(本地镜像注册中心,registry)
- docker镜像构建工具kaniko构建过程缓慢原因探究
- docker客户端连接远程docker服务端(export方式)
- docker 每次都得source /etc/profile以及如何查看Docker容器环境变量、向容器传递环境变量
- Docker的save和export命令的区别
- Docker-compose 安装 rocketmq
- 分析 k8s docker 查看 内存 CPU使用率 k8s docker 性能 分析
- Docker与iptables 只允许特定ip访问Docker的服务 通过iptables限制docker容器端口
- /var/lib/docker/overlay2 占用很大,清理Docker占用的磁盘空间
- 【云原生之Docker实战】使用docker部署yesplaymusic个人音乐播放器
- 【云原生之Docker实战】使用docker部署kooteam在线团队协作工具
- 【云原生之Docker实战】使用docker部署PicUploader图床工具
- docker-compose安装yapi接口文档工具——筑梦之路
- Docker学习笔记06:docker使用之Hello World
- docker overlay2存储驱动简介
- Prune unused Docker objects