1. Download docker online yum install -y epel-release yum install docker-io # Install docker chkconfig docker on # Add service to boot docker start # Start docker service 2. Install Tomcat container with docker 2.1. Find the server's tomcat information # docker search tomcat 2.2 Download the official image with the highest Starts docker pull docker.io/tomcat 2.3 View all docker images docker images 2.4 Start tomcat docker run -p 8081:8080 docker.io/tomcat # If the port is occupied, you can specify the mapping port of the container and the host. The former is the external access port: the latter is the internal port of the container 2.5 After startup, you can access 192.168.138.132:8080 3. Deploy your own web reference docker ps # Use the following command to view the running container 3.1. Upload your own war package to the host 3.2. Execute and view the address in the container comcat docker exec -it 3cb492a27475 /bin/bash #The one in the middle is the container ID (CONTAINER_ID) 3.3 Drop the war package to the host machine, then drop it into the container and drop it into tomcat/webapps docker cp NginxDemo.war 3cb492a27475 :/usr/local/tomcat/webapps 3.4. Start tomcat or restart docker restart [container id] docker run -p 8081:8080 docker.io/tomcat 3.5 Check if the image has been started docker ps 3.6 Execute and view the project in the container comcat docker exec -it 3cb492a27475 /bin/bash #The one in the middle is the container ID (CONTAINER_ID) cd /webapps ls # You can view our project 3.7 The above execution has a disadvantage that the project will no longer exist after the container is restarted. The following is method 2 to start by mounting docker run -d -v /usr/docker_file/NginxDemo.war:/usr/local/tomcat/webapps/NginxDemo.war -p 8080:8080 docker.io/tomcat 3.8 The first two methods are recommended to be used in a test environment, since the code needs to be modified frequently. Method 3 can be used in production. This is also the method recommended by the official website vi Dockerfile from docker.io/tomcat:latest #your tomcat image MAINTAINER [email protected] #author COPY NginxDemo.war /usr/local/tomcat/webapps #Place it in the webapps directory of tomcat 3.8.1 Generate a new image: docker build -t nginx-demo:v1 . 3.8.2 Start a new image docker run -p 8080:8080 nginx-demo:v1 other # Basic information View docker version # View the version number of docker, including the client, server, dependent Go, etc. docker info # View system (docker) level information, including managed images, number of containers, etc. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: VMware kali virtual machine environment configuration method
>>: Using react+redux to implement counter function and problems encountered
I accidentally found that Vue.$set was invalid in...
Simple function: Click the plug-in icon in the up...
Click here to return to the 123WORDPRESS.COM HTML ...
A simple license plate input component (vue) for ...
In the previous article, we explained how nginx r...
Overview Let's summarize some SQL statements ...
Core code <!DOCTYPE html> <html lang=&qu...
1. Basic Specifications (1) InnoDB storage engine...
The accessibility of web pages seems to be somethi...
Table of contents 1. Introduction 2. Principle II...
Method 1: Use table attributes: header-cell-class...
The action of the form is different from the URL j...
The advantages of this solution are simplicity an...
A mature database architecture is not designed wi...
How to reset the initial value of the auto-increm...