: 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.