标签:fail 约束 服务 size ted mon des restart 信息
vote:
image: dockersamples/examplevotingapp_vote:before
ports:
- 5000:80
networks:
- frontend
depends_on:
- redis
deploy:
replicas: 2
update_config:
parallelism: 2
restart_policy:
condition: on-failure
version: "3"
services:
redis:
image: redis:alpine
ports:
- "6379"
networks:
- frontend
deploy:
replicas: 2
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
db:
image: postgres:9.4
volumes:
- db-data:/var/lib/postgresql/data
networks:
- backend
deploy:
placement:
constraints: [node.role == manager]
vote:
image: dockersamples/examplevotingapp_vote:before
ports:
- 5000:80
networks:
- frontend
depends_on:
- redis
deploy:
replicas: 2
update_config:
parallelism: 2
restart_policy:
condition: on-failure
result:
image: dockersamples/examplevotingapp_result:before
ports:
- 5001:80
networks:
- backend
depends_on:
- db
deploy:
replicas: 2
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
worker:
image: dockersamples/examplevotingapp_worker
networks:
- frontend
- backend
deploy:
mode: replicated
replicas: 1
labels: [APP=VOTING]
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 3
window: 120s
visualizer:
image: dockersamples/visualizer:stable
ports:
- "8080:8080"
stop_grace_period: 1m30s
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
networks:
frontend:
backend:
volumes:
db-data:
docker-stack.yml
是 Compose file 中的一个新文件类型,只和Compose Version 3兼容。
deploy 关键字,允许我们指定一个集群部署(swarm deployment)的各种特性。
比如,voting app 配置中,使用这个关键字,创建了 vote 和 result services 的副本(每个service有两个 container,被部署到swarm集群中).
voting app 同样使用 deploy
约束某些services只能够在manager node中执行。
该命令只支持 version: "3" 的
Compose files.
不支持关键字 build
,这之前是在标准 Compose files中被支持的, 而Compose file则是基于 Dockerfile的。为了使用 docker stack deploy
,我们需要使用 pre-built image
它可以替代命令 docker compose up
来运行与 Version 3 兼容的 applications.
标签:fail 约束 服务 size ted mon des restart 信息
原文地址:http://www.cnblogs.com/zhxshseu/p/8cb5c671b237b69f69c56d3e85c72f06.html