Tomcat+mysql+javaweb+docker

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.