docker安装tomcat
1.下载docker环境下的tomcat
地址:https://hub.docker.com,进入docker市场去搜索tomcat
推荐拉取下面的tomcat
docker pull tomcat:8.5.83-jre8-temurin-jammy
2.运行tomcat
docker run -d -p 8888:8080 --name=mytomcat -v /app/tomcat/webapps:/usr/local/tomcat/webapps -v /app/tomcat/logs:/usr/local/tomcat/logs --restart=always --preivileged=true 825a66
3.将运行tomcat中webapp.dist中的文件移动到webapps
docker exec -it 825a66 /bin/bash mv ./webapps.dist/* ./webapps
4.将tomcat中logs, webapps, conf 拷贝到 宿主主机上
docker cp mytomcat:/usr/local/webapps /app/tomcat/ docker cp mytomcat:/usr/local/logs /app/tomcat/ docker cp mytomcat:/usr/local/conf /app/tomcat/
5.查看docker下的ip地址
docker inspect container_id 或 docker inspect container_id | grep ip address