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
This article shares the specific code for JavaScr...
Delete the previously installed mariadb 1. Use rp...
<body> <div id="root"> <...
MySQL deployment Currently, the company deploys M...
1. Query speed of two query engines (myIsam engin...
Causes and consequences 1. When using the ansible...
1. Principle of Hotlinking 1.1 Web page preparati...
——Notes from "MySQL in Simple Terms (Second ...
Preface Adding drag and drop functionality is a g...
Table of contents 1. Define object methods 2. Def...
1. Resume nacos database Database name nacos_conf...
1. Introduction When we log in to MySQL, we often...
The relevant person in charge of Baidu Input Metho...
Preface <br />In the previous article "...
<br />When you click the link, the web page ...