-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
36 lines (33 loc) · 951 Bytes
/
docker-compose.yml
File metadata and controls
36 lines (33 loc) · 951 Bytes
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
services:
mysqldb: # this name can be anything
image: mysql:8.0 # this name has to match docker hub image:tag
ports:
- "3306:3306" # host_port:container_port
environment:
- MYSQL_ROOT_PASSWORD=root123
- MYSQL_DATABASE=sbm
volumes:
- mysql-data:/var/lib/mysql # change to ./mysql-data:/var/lib/mysql to store data inside the project dir
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 1m30s
timeout: 30s
retries: 5
start_period: 30s
networks:
- springboot-db-net
application:
build: .
depends_on:
mysqldb:
condition: service_healthy
ports:
- "8080:8080" # host_port:container_port
networks:
- springboot-db-net
networks:
springboot-db-net:
# run docker volume create mysql-data prior to managed data inside external named volume.
volumes:
mysql-data:
external: true