forked from hengfengli/nginx-keepalived-docker-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
44 lines (43 loc) · 1.07 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
version: "3"
services:
nginx_master:
container_name: k_n_master
build:
context: ./
dockerfile: ./Dockerfile
volumes:
- ./index-master.html:/usr/share/nginx/html/index.html
- ./favicon.ico:/usr/share/nginx/html/favicon.ico
- ./keepalived-master.conf:/etc/keepalived/keepalived.conf
networks:
static-network:
ipv4_address: 172.20.128.2
cap_add:
- NET_ADMIN
nginx_slave:
container_name: k_n_slave
build:
context: ./
dockerfile: ./Dockerfile
volumes:
- ./index-slave.html:/usr/share/nginx/html/index.html
- ./favicon.ico:/usr/share/nginx/html/favicon.ico
- ./keepalived-slave.conf:/etc/keepalived/keepalived.conf
networks:
static-network:
ipv4_address: 172.20.128.3
cap_add:
- NET_ADMIN
proxy:
image: haproxy:1.7-alpine
ports:
- 8000:6301
volumes:
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
networks:
- static-network
networks:
static-network:
ipam:
config:
- subnet: 172.20.0.0/16