1.Install Docker
2. Docker pull Tomcat Docker pull MySQL
3. Docker run-it-p 8080:8080--rm tomcat:7.0
#-p Port Mappings
name of the #tomcat:7.0 Tomcat
4,Docker CP./exam.war kind_wescoff:/usr/local/tomcat/webapps/
# First go into the directory where the./exam.war is located
#kind_wescoff Tomcat the name of this container
# The entire command line: Copy the local project to the Tomcat container WebApps directory
#exam.war:https://pan.baidu.com/s/1bogczov (database address, table name needs to be modified)
5. Docker run--name duan-mysql-p 3306:3306-e mysql_root_password=123456-d mysql:5.7
#--name the name of the specified container
Name of the #duan-mysql container
#-p Port Mappings
#-e MYSQL_ROOT_PASSWORD=123456-E Specifies the environment variable that can be used in the container
#mysql:5.7 MySQL image name
6. Verification: Http://localhost:8080/exam
7. Description:
This experiment is using the Tomcat+mysql+javaweb+docker combination, tomcat, MySQL have exposed the interface, so that the child two containers are quite virtual machine, so in the database connection directly using the IP address.
Tomcat+mysql+javaweb+docker