Run a javaweb application in Docker

Source: Internet
Author: User
Tags docker ps docker run

  1. Install Docker, this example uses CentOS 7, other systems installed please Baidu.
    1. Installation: Yum-y Install Docker
    2. Start: Service Docker start
    3. Some basic Docker commands are:
      1. Docker images
      2. Docker pull
      3. Docker PS
      4. Docker images xxxx
      5. Docker stop xxxx
      6. ......
  2. Installing Mysql:docker Pull mysql:5.6
  3. Run Mysql:docker run-d-P 3306:3306-e mysql_root_password=root mysql:5.6
    Command explanation:
    -e mysql_root_password=root means to change the root user's initialization password to root
    -D indicates background run
    -P 3,306:3,306 indicates port mappings for containers and virtual machines
  4. Installing Tomcat7:docker Pull Tomcat:7
  5. Upload a web app to the virtual machine/usr/local directory, here/usr/local/t, which reads the database and then uploads the data back to the browser for presentation.
  6. Start Tomcat in the Docker container

    Command explanation:
    -v/usr/local/t:/usr/local/tomcat/webapps/t to mount the T file in the/usr/local/directory of the virtual machine to the/usr/local/tomcat/webapps/directory
    -D indicates background run
    -P 5,217:8,080 indicates port mappings for containers and virtual machines
    --privileged=true to grant Docker mount permissions
  7. In the host input Http://ip:5217/T access the project:

Run a javaweb application in 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.