-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdocker-compose-simple.yml
More file actions
87 lines (78 loc) · 1.5 KB
/
docker-compose-simple.yml
File metadata and controls
87 lines (78 loc) · 1.5 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Simple Multi-Network Docker Compose Example
# This demonstrates basic multi-network concepts with fewer services
services:
# Frontend service
web:
image: nginx:alpine
ports:
- "80:80"
networks:
- frontend
- dmz
volumes:
- ./web/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- api
# API service
api:
build: ./api
networks:
- frontend
- backend
environment:
- DATABASE_URL=postgresql://user:pass@db:5432/mydb
depends_on:
- db
- cache
# Database service
db:
image: postgres:15-alpine
environment:
- POSTGRES_DB=mydb
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
networks:
- backend
volumes:
- db_data:/var/lib/postgresql/data
# Cache service
cache:
image: redis:7-alpine
networks:
- backend
volumes:
- cache_data:/data
# Admin interface
admin:
image: adminer:latest
ports:
- "8080:8080"
networks:
- backend
- dmz
depends_on:
- db
# Network definitions
networks:
# Frontend network - web-facing services
frontend:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/24
# Backend network - internal services
backend:
driver: bridge
ipam:
config:
- subnet: 172.21.0.0/24
# DMZ network - admin/management interfaces
dmz:
driver: bridge
ipam:
config:
- subnet: 172.22.0.0/24
# Volume definitions
volumes:
db_data:
cache_data: