File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,11 +132,17 @@ Requirements:
132132- Docker
133133- Docker Compose
134134
135- Build and start the lab :
135+ Option 1 : start with the published image:
136+
137+ ` ` ` shell
138+ docker compose -f docker-compose.image.yml up -d
139+ ` ` `
140+
141+ Option 2 : build the image locally and start the lab:
136142
137143` ` ` shell
138144mvn clean package -DskipTests
139- docker- compose -p javaseclab up -d
145+ docker compose -p javaseclab up -d
140146` ` `
141147
142148If the database is empty after startup, manually import [sql/JavaSecLab.sql](./sql/JavaSecLab.sql).
Original file line number Diff line number Diff line change @@ -132,11 +132,17 @@ cd JavaSecLab
132132- Docker
133133- Docker Compose
134134
135- 构建并启动:
135+ 方式一:直接使用已发布镜像启动:
136+
137+ ` ` ` shell
138+ docker compose -f docker-compose.image.yml up -d
139+ ` ` `
140+
141+ 方式二:本地构建镜像并启动:
136142
137143` ` ` shell
138144mvn clean package -DskipTests
139- docker- compose -p javaseclab up -d
145+ docker compose -p javaseclab up -d
140146` ` `
141147
142148如果容器启动后数据库为空,请手动导入 [sql/JavaSecLab.sql](./sql/JavaSecLab.sql)。
Original file line number Diff line number Diff line change 1+ version : " 3"
2+
3+ services :
4+ mysql :
5+ image : mysql:8.0.33
6+ container_name : Container-MYSQL8
7+ restart : always
8+ ports :
9+ - 3306:3306
10+ environment :
11+ MYSQL_ROOT_PASSWORD : QWE123qwe
12+ MYSQL_DATABASE : JavaSecLab
13+ volumes :
14+ - ./sql/JavaSecLab.sql:/docker-entrypoint-initdb.d/JavaSecLab.sql
15+ networks :
16+ - JavaSecLabNet
17+
18+ JavaSecLab :
19+ image : whgojp/javaseclab:1.5
20+ container_name : Container-JavaSecLab
21+ restart : always
22+ ports :
23+ - 80:80
24+ environment :
25+ - TZ=Asia/Shanghai
26+ - SPRING_PROFILES_ACTIVE=docker
27+ depends_on :
28+ - mysql
29+ volumes :
30+ - ./logs:/logs
31+ networks :
32+ - JavaSecLabNet
33+
34+ networks :
35+ JavaSecLabNet :
36+ driver : bridge
37+ ipam :
38+ config :
39+ - subnet : 192.168.1.0/24
You can’t perform that action at this time.
0 commit comments