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

CSS3 realizes the childhood paper airplane

Today we are going to make origami airplanes (the...

Graphic tutorial on installing Ubuntu 18.04 on VMware 15 virtual machine

In the past few years, I have been moving back an...

Vue.js implements tab switching and color change operation explanation

When implementing this function, the method I bor...

Embedded transplant docker error problem (summary)

After a long period of transplantation and inform...

Let's talk about bitwise operations in React source code in detail

Table of contents Preface Several common bit oper...

A brief discussion on the lock range of MySQL next-key lock

Preface One day, I was suddenly asked about MySQL...

MySQL 8.0.18 uses clone plugin to rebuild MGR implementation

Assume that a node in the three-node MGR is abnor...

How to use CSS counters to beautify ordered lists of numbers

In web design, it is very important to use an org...

How to use the debouce anti-shake function in Vue

Table of contents 1. Anti-shake function 2. Use d...

WeChat applet realizes simple tab switching effect

This article shares the specific code for WeChat ...

How to use native JS to implement touch sliding monitoring events

Preface I wrote a small demo today. There is a pa...

Mysql query the most recent record of the sql statement (optimization)

The worst option is to sort the results by time a...

Solve the problem of insufficient docker disk space

After the server where Docker is located has been...