Docker: simplest practice notes

Source: Internet
Author: User
: This article mainly introduces Docker: the simplest practical notes. if you are interested in the PHP Tutorial, refer to it. Let's begin the handover today and summarize some things.

Environment:

You have installed several images, including Tomcat.

Create a directory to create an image with a WEB application, such as sys-webapp:
Go to this directory and create a Dockerfile with the following content:

FROM tomcat:latestCOPY sys.war /usr/local/tomcat/webapps/sys.warCMD ["catalina.sh","run"] 

Then, use SFTP to upload our sys. war to the current directory. Run the following command (note that the current directory is located next to it ):

docker build -t tomcat/sys-webapp.

-T specifies the tag. This will generate a new Image, which can be viewed using the docker images command.

Run the following command:

docker run -d--name sys -p8000:8080 tomcat/sys-webapp

-D is run in the background.-name is used for subsequent operations.-p specifies the port ing (local port: Container Port) and then the image name.

Now we can access port 10.250.251.20: 8000 to see the deployed application.

Run the following command to start a container with the Port 8001 ing:

docker run -d--name sys2 -p8001:8080 tomcat/sys-webapp

Then, configure a pool in Nginx:

upstream sys-webapp-pool {   ip_hash;   server10.250.251.20:8000;   server10.250.251.20:8001;}   

In fact, Docker is very convenient to use, but in practice, we still have something to configure, such as specifying the CPU cores for the image during build, memory limit.

'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
  • '). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script

    The above introduces Docker: the simplest practice notes, including some content, hope to be helpful to friends who are interested in PHP tutorials.

    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.