上传一份docker swarm的yaml文件
1、 创建overlay网络docker network create --driver overlay app2、编写yaml配置文件[root@izj6ce8rjhet0gdu35qpm2z cpct]# cat docker-compose-dispatcher.ymlversion: "3"services:dispatcher:image: advf/dispatcher:latesth
·
1、 创建overlay网络
docker network create --driver overlay app
2、编写yaml配置文件
[root@izj6ce8rjhet0gdu35qpm2z cpct]# cat docker-compose-dispatcher.yml
version: "3"
services:
dispatcher:
image: advf/dispatcher:latest
hostname: dispatcher
ports:
- "8090:8080"
networks:
- app
environment:
zookeeper.host: zookeeper://zookeeper-dk:2181
deploy:
placement:
constraints: [node.role == manager]
eth-sync:
image: advf/eth-sync:latest
ports:
- "8093:8093"
networks:
- app
environment:
zookeeper.host: zookeeper://zookeeper-dk:2181
deploy:
placement:
constraints: [node.role == manager]
visualizer:
image: dockersamples/visualizer:stable
ports:
- "8099:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
networks:
- cpctapp
networks:
app:
external: true
3、编写redis和zookeeper yaml配置文件
[root@izj6ce8rjhet0gdu35qpm2z ~]# cat docker-compose.yml
version: "3"
services:
redis-dk:
image: redis
restart: always
container_name: redis-dk
hostname: redis-dk
# ports:
# - "6379:6379"
networks:
- app
deploy:
placement:
constraints: [node.role == manager]
zookeeper-dk:
image: zookeeper
restart: always
container_name: zookeeper-dk
hostname: zookeeper-dk
ports:
- "2181:2181"
# volumes:
# - /root/cpct/zookeeper/data:/data
# - /root/cpct/zookeeper/datalog:/datalog
networks:
- app
deploy:
placement:
constraints: [node.role == manager]
data-service:
image: advf/data-service:latest
# ports:
# - "8092:8092"
# - "20880:20880"
networks:
- app
depends_on:
- redis-dk
- zookeeper-dk
environment:
zookeeper.host: zookeeper://zookeeper-dk:2181
deploy:
placement:
constraints: [node.role == manager]
networks:
app:
external: true
3、启动脚本
[root@izj6ce8rjhet0gdu35qpm2z ~ ]# cat deploy_swarm.sh
#!/usr/bin/env bash
docker stack deploy -c docker-compose.yml swarm
sleep 20
docker stack deploy -c docker-compose-dispatcher.yml swarm
更多推荐
已为社区贡献10条内容
所有评论(0)