Docker Swarm -


Apache
Linux
Google Go

软件简介

Docker
Swarm是一个Dockerized化的分布式应用程序的本地集群,它是在Machine所提供的功能的基础上优化主机资源的利用率和容错服务。具体来说,Docker
Swarm支持用户创建可运行Docker Daemon的主机资源池,然后在资源池中运行Docker容器。Docker
Swarm可以管理工作负载并维护集群状态。

除了资源优化,Docker Swarm可以保证应用的高可用性和容错性。Docker Swarm会不断的检查Docker
Daemon所在主机的健康状态。当某个主机不可用时,Swarm就会将容器迁移到新的主机上。

Docker Swarm的亮点之一是它可以在应用的生命周期内扩展,也就是说当应用从一个主机扩展到2个、20个或者200个的时候,用户可以保证接口的一致性。

同样,和Machine一样,Swarm的架构是可插拔的,系统已经包含一个默认的调度器。其它的厂商可以实现自己的调度器。

使用示例:

# create a cluster
$ docker run --rm swarm create
6856663cdefdec325839a4b7e1de38e8 # <- this is your unique <cluster_id>

# on each of your nodes, start the swarm agent
#  <node_ip> doesn't have to be public (eg. 192.168.0.X),
#  as long as the swarm manager can access it.
$ docker run -d swarm join --addr=<node_ip:2375> token://<cluster_id>

# start the manager on any machine or your laptop
$ docker run -d -p <swarm_port>:2375 swarm manage token://<cluster_id>

# use the regular docker cli
$ docker -H tcp://<swarm_ip:swarm_port> info
$ docker -H tcp://<swarm_ip:swarm_port> run ...
$ docker -H tcp://<swarm_ip:swarm_port> ps
$ docker -H tcp://<swarm_ip:swarm_port> logs ...
...

# list nodes in your cluster
$ docker run --rm swarm list token://<cluster_id>
<node_ip:2375>

介绍内容来自 DockerOne