- There is a command docker pull tomcat to pull the latest tomcat image
- Use docker images command, whether the pull is successful
- Use the command docker run --name mytomcat -p 8080:8080 -d tomcat to create the container
Use the command docker ps to see if the creation is successful --name
: give the created container a name
-p: correspond the port number of the host to the port number of the container
-d: Mirror name
Description of the problem
After installing docker, directly pull the tomcat image of Alibaba Cloud. There is no problem when it starts successfully, but this will happen when accessing the address. The
cause of the problem is that
the tomcat image pulled directly contains a webapps and a webapps The .dist folder, our normal access situation is the webapps folder, but the image we pulled directly is empty and there is nothing, so the access result is 404
Solution
Copy the content of webapps.dist to webapps and it's ok.
Use docker exec-it mytomcat /bin/ bash to enter tomcat
-i: interactive
-t: terminal
Then copy the content of webapps.dist to webapps
and then access it.