Solution to 404 Problem of Tomcat Installation in Docker

Solution to 404 Problem of Tomcat Installation in Docker

Find the containerID of tomcat and enter the tomacat directory:

[root@promote ~]# docker ps 
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b52c4a46a432 nginx "/docker-entrypoin..." 4 minutes ago Up 4 minutes 0.0.0.0:8081->80/tcp nginx-test
02ffbf387631 tomcat "catalina.sh run" 45 minutes ago Up 45 minutes 0.0.0.0:8080->8080/tcp mytomcat

Check webapps and find it is empty

[root@promote ~]# docker exec -it 02ffbf387631 /bin/bash
root@02ffbf387631:/usr/local/tomcat# ls -l
total 124
-rw-r--r--. 1 root root 18982 Sep 10 08:25 BUILDING.txt
-rw-r--r--. 1 root root 5409 Sep 10 08:25 CONTRIBUTING.md
-rw-r--r--. 1 root root 57092 Sep 10 08:25 LICENSE
-rw-r--r--. 1 root root 2333 Sep 10 08:25 NOTICE
-rw-r--r--. 1 root root 3257 Sep 10 08:25 README.md
-rw-r--r--. 1 root root 6898 Sep 10 08:25 RELEASE-NOTES
-rw-r--r--. 1 root root 16262 Sep 10 08:25 RUNNING.txt
drwxr-xr-x. 2 root root 4096 Sep 15 22:33 bin
drwxr-xr-x. 1 root root 22 Oct 10 01:45 conf
drwxr-xr-x. 2 root root 4096 Sep 15 22:33 lib
drwxrwxrwx. 1 root root 177 Oct 10 01:45 logs
drwxr-xr-x. 2 root root 134 Sep 15 22:33 native-jni-lib
drwxrwxrwx. 2 root root 30 Sep 15 22:33 temp
drwxr-xr-x. 2 root root 6 Sep 15 22:33 webapps
drwxr-xr-x. 7 root root 81 Sep 10 08:23 webapps.dist
drwxrwxrwx. 2 root root 6 Sep 10 08:20 work
root@02ffbf387631:/usr/local/tomcat# cd webapps
root@02ffbf387631:/usr/local/tomcat/webapps# ls -l
total 0

Delete webapps and rename webapps.dist to webapps

root@02ffbf387631:/usr/local/tomcat/webapps# cd ..
root@02ffbf387631:/usr/local/tomcat# rm -rf webapps
root@02ffbf387631:/usr/local/tomcat# mv webapps.dist webapps
root@02ffbf387631:/usr/local/tomcat# cd webapps
root@02ffbf387631:/usr/local/tomcat/webapps# ls -l
total 8
drwxr-xr-x. 3 root root 4096 Sep 15 22:33 ROOT
drwxr-xr-x. 15 root root 4096 Sep 15 22:33 docs
drwxr-xr-x. 6 root root 83 Sep 15 22:33 examples
drwxr-xr-x. 5 root root 87 Sep 15 22:33 host-manager
drwxr-xr-x. 6 root root 114 Sep 15 22:33 manager

Re-access in your browser:

If you don't commit, after the image is restarted, a 404 error will be reported again. You need to commit

[root@promote ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b52c4a46a432 nginx "/docker-entrypoin..." 43 minutes ago Up 42 minutes 0.0.0.0:8081->80/tcp nginx-test
02ffbf387631 tomcat "catalina.sh run" About an hour ago Up About an hour 0.0.0.0:8080->8080/tcp mytomcat
[root@promote ~]# docker commit 02ffbf387631 mytomcat
sha256:b2c4b37c92c5c26b1285756bf04365b8f5a42a86d519a767ea528cda1af9a81a

No configuration is required for the next visit, just access the tomcat page directly

This is the end of this article about the solution to the 404 problem of installing Tomcat in docker. For more relevant content about installing Tomcat in docker 404, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Introduction to possible problems after installing Tomcat

<<:  Implementation of mysql split function separated by commas

>>:  Memcached method for building cache server

Recommend

Detailed introduction and usage examples of map tag parameters

Map tags must appear in pairs, i.e. <map> .....

JS implements request dispatcher

Table of contents Abstraction and reuse Serial Se...

HTML table markup tutorial (16): title horizontal alignment attribute ALIGN

By default, the table title is horizontally cente...

Vue3.0 handwriting magnifying glass effect

The effect to be achieved is: fixed zoom in twice...

MySQL Packet for query is too large problem and solution

Problem description: Error message: Caused by: co...

3 different ways to clear the option options in the select tag

Method 1 Copy code The code is as follows: documen...

How to use Docker container to access host network

Recently, a system was deployed, using nginx as a...

MySQL query statement simple operation example

This article uses examples to illustrate the simp...

Example of using CSS3 to customize the style of input multiple-select box

Principle: First hide the input element, then use...

About Generics of C++ TpeScript Series

Table of contents 1. Template 2. Generics 3. Gene...

Two problems encountered when deploying rabbitmq with Docker

1. Background The following two problems are enco...

One-click installation of MySQL 5.7 and password policy modification method

1. One-click installation of Mysql script [root@u...

CSS to achieve horizontal lines on both sides of the middle text

1. The vertical-align property achieves the follo...

Understanding and using callback functions in JavaScript

Table of contents Overview What are callbacks or ...