2024-08-30 05:03:07.508 INFO 21 --- [ main] com.dn.es.ProjectExamSystemApplication : Starting ProjectExamSystemApplication vV1.0.0 using Java 17.0.12 with PID 21 (/Project_ExamSystem-V1.0.0.war started by root in /)
2024-08-30 05:03:07.511 INFO 21 --- [ main] com.dn.es.ProjectExamSystemApplication : No active profile set, falling back to 1 default profile: "default"
2024-08-30 05:03:09.435 INFO 21 --- [ main] o.s.d.r.config.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2024-08-30 05:03:09.440 INFO 21 --- [ main] o.s.d.r.config.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2024-08-30 05:03:09.497 INFO 21 --- [ main] o.s.d.r.config.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 31 ms. Found 0 Redis repository interfaces.
2024-08-30 05:03:11.178 INFO 21 --- [ main] o.s.boot.web.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2024-08-30 05:03:15.732 INFO 21 --- [ main] o.s.boot.web.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
2024-08-30 05:03:15.815 INFO 21 --- [ main] com.dn.es.ProjectExamSystemApplication : Started ProjectExamSystemApplication in 9.652 seconds (process running for 10.863)
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a07feb046ee mysql:5.7.44 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp optimistic_herschel
464d9b2b5f0b java:v0 "/bin/bash" 2 hours ago Up About an hour 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp epic_pascal
11568e4a8864 nginx:latest "/docker-entrypoint.…" 3 hours ago Up About an hour 0.0.0.0:80->80/tcp, :::80->80/tcp vibrant_gates
复制代码
3.在project_exam_system/目次下创建mysql目次
[root@docker001 ~]# mkdir mysql
[root@docker001 ~]# mv mysql project_exam_system/
[root@docker001 ~]# ls project_exam_system/
mysql web
复制代码
4.远程登录mysql运行project_exam_system.sql文件
5.使用exec下令登录mysql
[root@docker001 ~]# docker exec -it 1a mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.44 MySQL Community Server (GPL)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# 查看数据库
mysql> show databases;
+---------------------+
| Database |
+---------------------+
| information_schema |
| mysql |
| performance_schema |
| project_exam_system |
| sys |
+---------------------+
5 rows in set (0.00 sec)
# 创建和java项目中的用户
mysql> create user 'zhangmin'@'%' identified by 'zhangmin';
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1aa141a489fb java:v1 "/start.sh /bin/bash" 5 seconds ago Up 5 seconds 0.0.0.0:8081->8080/tcp, :::8081->8080/tcp jolly_buck
1a07feb046ee mysql:5.7.44 "docker-entrypoint.s…" About an hour ago Up About an hour 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp optimistic_herschel
464d9b2b5f0b java:v0 "/bin/bash" 3 hours ago Up 2 hours 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp epic_pascal
11568e4a8864 nginx:latest "/docker-entrypoint.…" 4 hours ago Up 2 hours 0.0.0.0:80->80/tcp, :::80->80/tcp vibrant_gates
复制代码
13.查看容器是否开启服务
# 使用exec命令查看容器内开启的端口
[root@docker001 java]# docker exec 1aa141 ss -tuln|grep 8080