1. Download the Tocmat image using Docker

According to the Docker official website, first use the Docker pull tomcat command to download the Tomcat image. When pull is complete, you can use the following command:

docker run --name tomcat -p 8082:8080 -v /usr/web/soarunner-log:/opt/tomcat/soarunner tomcat
Copy the code

You can start Tomcat, including port mapping and file mapping.

2. On the host computer, go to the Tomcat home page

After setting the port mapping in the Virtual Box:

In this case, tomcat can be accessed from the host using {host IP address/VM IP address}+ port. If 404 is displayed after Tomcat is started, you can perform the following steps:

  • 1. Enter the Tomcat container:
Docker exec it {container PID} /bin/bashCopy the code
  • Check whether the Webapps folder in the current directory is empty

  • If it is empty, move the content in Webapps. Dist to Webapps, as shown below:

  • Docker restart Docker restart docker restart

Reference Documents:

  • Vm Docker starts Tomcat and hosts access 404-CSDN