Solution to the problem of not being able to access the home page when adding a tomcat container to Docker

Solution to the problem of not being able to access the home page when adding a tomcat container to Docker

question

The tomcat container was successfully added using the docker run command. The port was also opened. I also tried to turn off the firewall, but it always displayed 404 when accessing the tomcat homepage.

reason

The default version of the tomcat image obtained using Alibaba Cloud is 8.5.51. Its webapps file is empty, and its welcome page is placed in the webapps.dist file. This is why we will access it incorrectly.

Workaround

Delete the original webapps or change its name to another one, and rename webapps.dist to webapps

The steps are as follows:

1. Enter the interactive mode with tomcat in docker

[root@localhost ~]# docker exec -it your tomcat container ID /bin/bash

root@b3589cdf16cc:/usr/local/tomcat#

2. Modify the directory

ls -lroot@b3589cdf16cc:/usr/local/tomcat# mv webapps webapps2

root@b3589cdf16cc:/usr/local/tomcat# mv webapps.dist

3. Exit interactive mode

webappsroot@b3589cdf16cc:/usr/local/tomcat# exit

Example:

Access port 32768 in the host machine, which will be mapped to port 8080 of tomcat

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:
  • Why can't I see the access interface for Docker Tomcat?

<<:  React realizes the whole process of page watermark effect

>>:  Essential bonus items for optimizing and packaging the front end of Vue projects

Recommend

How to safely shut down a MySQL instance

This article analyzes the process of shutting dow...

Why does your height:100% not work?

Why doesn't your height:100% work? This knowl...

Getting Started Tutorial on Using TS (TypeScript) in Vue Project

Table of contents 1. Introducing Typescript 2. Co...

MySql Group By implements grouping of multiple fields

In daily development tasks, we often use MYSQL...

HTML table markup tutorial (9): cell spacing attribute CELLSPACING

A certain distance can be set between cells in a ...

Summary of common commands for building ZooKeeper3.4 middleware under centos7

1. Download and decompress 1. Introduction to Zoo...

Markup Language - Title

Click here to return to the 123WORDPRESS.COM HTML ...

Django+mysql configuration and simple operation database example code

Step 1: Download the mysql driver cmd enters the ...

Some pitfalls of JavaScript deep copy

Preface When I went to an interview at a company ...

Detailed explanation of HTML basic tags and structures

1. HTML Overview 1.HTML: Hypertext Markup Languag...

How to add vim implementation code examples in power shell

1. Go to Vim's official website to download t...

Detailed explanation of JavaScript upload file limit parameter case

Project scenario: 1. Upload file restrictions Fun...