Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install tomcat in docker

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

It is believed that many inexperienced people have no idea about how to install tomcat in docker. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1. Find the image

Docker search tomcat

2. Download the image

Docker pull tomcat

3. Start the image = "if you need to mount, refer to step 6; it is recommended to mount the directory; if you do not know the internal path, you can create an instance at will, find the path, and then recreate the instance after establishing the directory."

Docker run-d-name tomcat-p 8081 tomcat

-d: running in the background

-- name tomcat: alias to tomcat

-p 8081: start on port 8081

8080:docker container port

Tomcat: mirroring

4. Enter the container

4.1 View Container

Enter the container "docker exec-it container name bash"

Docker exec-it tomcat bash

5. Import war package

Docker cp / usr/local/docker/tomcat/erp.war tomcat:/usr/local/tomcat/webapps/

6. Mount the path and mount the container when creating the container.

Docker run-d\-name tomcat\-p 8081 usr/local/docker/tomcat/webapps/:/usr/local/tomcat/webapps 8080\-v / usr/local/docker/tomcat/webapps/:/usr/local/tomcat/webapps\-v / usr/local/docker/tomcat/conf/:/usr/local/tomcat/conftomcat

If the command is not valid, enter it yourself manually.

Possible problems:

Modify time zone = "incorrect time zone, resulting in abnormal data saving

Docker exec-it tomcat bash echo "Asia/Shanghai" > / etc/timezone

Tomcat8 cookie domain

Cd / usr/local/docker/tomcat/conf vim context.xml

Add CookieProcessor

After reading the above, have you mastered how to install tomcat in docker? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report