Docker container/service/stack/swarm
2018-03-16 14:59
246 查看
In a distributed application, different pieces of the app are called “services.”面向服务的分布式系统架构设计(SOA)
若干个基于同一个image的Container instances,构成一个serviceA single container running in a service is called a task.
多个Services构成一个stack
使用docker-compose.yml 文件 定义一个stack定义service(包括image、replicas、resources limits、ports、networks等)
提供load-balancingcontainers of all services will be distributed between nodes of a swarm
如果当前只有swarm中只有一个node,则所有container会集中在当前node上。
所有node,都可以暴露自己的IP地址、并将请求通过轮询方式转发给同一个service下的所有container
ingress routing meshThe reason all IP addresses work is that nodes in a swarm participate in an ingress routing mesh
但是注意:Keep in mind that in order to use the ingress network in the swarm, you need to have the following ports open between the swarm nodes before you enable swarm mode:* Port 7946 TCP/UDP for container network discovery.
* Port 4789 UDP for the container ingress network.
一个swarm就是一个cluster
一个swarm中的machines分成两类:Swarm managersexecutes management commands the commands you execute will be on the swarm, rather than just on the current machine.
and authenticates other machines to join the swarm as workers
workersonly swarm managers execute Docker commands; workers are just for capacity(容量)
Swarm initialized运行命令docker swarm init --advertise-addr <network interface ip>,会将current node 设置为 a swarm manager
add a worker to this swarm
add a manager to this swarm参考Swarm initialized的时候的输出信息
让当前node Leaving a swarm运行命令docker swarm leave
deploy a stackdocker swarm (蜂群)initstack运行在swarm mode下。。所以必须首先启动swarm mode
docker stack deploy -c docker-compose.yml {stack_name}docker stack deploy就是一个多级命令
自动生成service_name、network_name
移除stackdocker stack rm {stack_name}
动态扩展(scale)stackchanging settings(比如replicas) in docker-compose.yml,
saving the change,
and re-running the docker stack deploy command
Always run docker swarm init and docker swarm join with port 2377 or no port at all and let it take the default.
因为它是the swarm management port,
port 2376, which is the Docker daemon port.
A stack is a group of interrelated(有关系的) services that share dependencies, and can be orchestrated(编排) and scaled together
添加多个serviceadd services to our docker-compose.yml file
注意几个定义选项a volumes key, 授权当前service提供访问host machine上的某些文件/目录(绝对路径)
注意文件路径不对,可能引发错误。
使用docker stack ps --no-trunc {stack_name},查看ERROR列信息来调试
a placement key, ensuring that this service only ever runs on a swarm manager – never a worker.
commandservice启动的时候,执行的命令行命令??
两个image:dockersamples/visualizer:stabledisplays Docker services running on a swarm in a diagram.
redisRedis has an official image in the Docker library and has been granted the short image name of just redis, so no username/repo notation here
若干个基于同一个image的Container instances,构成一个serviceA single container running in a service is called a task.
多个Services构成一个stack
使用docker-compose.yml 文件 定义一个stack定义service(包括image、replicas、resources limits、ports、networks等)
提供load-balancingcontainers of all services will be distributed between nodes of a swarm
如果当前只有swarm中只有一个node,则所有container会集中在当前node上。
所有node,都可以暴露自己的IP地址、并将请求通过轮询方式转发给同一个service下的所有container
ingress routing meshThe reason all IP addresses work is that nodes in a swarm participate in an ingress routing mesh
但是注意:Keep in mind that in order to use the ingress network in the swarm, you need to have the following ports open between the swarm nodes before you enable swarm mode:* Port 7946 TCP/UDP for container network discovery.
* Port 4789 UDP for the container ingress network.
一个swarm就是一个cluster
一个swarm中的machines分成两类:Swarm managersexecutes management commands the commands you execute will be on the swarm, rather than just on the current machine.
and authenticates other machines to join the swarm as workers
workersonly swarm managers execute Docker commands; workers are just for capacity(容量)
Swarm initialized运行命令docker swarm init --advertise-addr <network interface ip>,会将current node 设置为 a swarm manager
add a worker to this swarm
add a manager to this swarm参考Swarm initialized的时候的输出信息
让当前node Leaving a swarm运行命令docker swarm leave
deploy a stackdocker swarm (蜂群)initstack运行在swarm mode下。。所以必须首先启动swarm mode
docker stack deploy -c docker-compose.yml {stack_name}docker stack deploy就是一个多级命令
自动生成service_name、network_name
移除stackdocker stack rm {stack_name}
动态扩展(scale)stackchanging settings(比如replicas) in docker-compose.yml,
saving the change,
and re-running the docker stack deploy command
Always run docker swarm init and docker swarm join with port 2377 or no port at all and let it take the default.
因为它是the swarm management port,
port 2376, which is the Docker daemon port.
A stack is a group of interrelated(有关系的) services that share dependencies, and can be orchestrated(编排) and scaled together
添加多个serviceadd services to our docker-compose.yml file
注意几个定义选项a volumes key, 授权当前service提供访问host machine上的某些文件/目录(绝对路径)
注意文件路径不对,可能引发错误。
使用docker stack ps --no-trunc {stack_name},查看ERROR列信息来调试
a placement key, ensuring that this service only ever runs on a swarm manager – never a worker.
commandservice启动的时候,执行的命令行命令??
两个image:dockersamples/visualizer:stabledisplays Docker services running on a swarm in a diagram.
redisRedis has an official image in the Docker library and has been granted the short image name of just redis, so no username/repo notation here
相关文章推荐
- Docker可视化界面(Consul+Shipyard+Swarm+Service Discover
- Docker可视化界面(Consul+Shipyard+Swarm+Service Discover)部署记录
- Docker 1.12实践:Docker Service、Stack与分布式应用捆绑包
- Docker 入门笔记 5 - 在Stack中部署多个service
- Docker - 通过swarm 管理 docker service
- Docker Swarm(Give a service access to volumes or bind mounts)
- docker探索-使用docker service管理swarm(十一 )
- 容器,Docker和Azure Container Service
- centos7下安装docker(23.docker-swarm之如何访问service)
- 基于Docker Swarm的Docker Service常见命令
- 深入理解Docker(镜像、容器、服务、swarm、stack)
- Docker Service的bundle与stack
- [原创]Docker学习记录: Shipyard+Swarm+Consul+Service Discover 搭建教程
- docker swarm如何在指定节点运行service
- docker swarm:执行 service update 过程中服务短暂不能访问的问题
- Consul & Registrator & Rails Service all together in separate Docker container
- docker-8-docker swarm docker stack
- centos7下安装docker(22.docker swarm-----service)
- 关于docker swarm有满满干货的一篇文章,讲了如何用service来作nginx负责proxy已级无缝升级策略
- Docker - 通过swarm 管理 docker service