Docker 安裝 Tomcat
Docker 安裝 Tomcat
1、搜尋映象 docker search tomcat
[root@MiWiFi-R3600-srv /]# docker search tomcat
2、下載映象 docker pull tomcat
[root@MiWiFi-R3600-srv /]# docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
e4c3d3e4f7b0: Pull complete
101c41d0463b: Pull complete
8275efcd805f: Pull complete
751620502a7a: Pull complete
a59da3a7d0e7: Pull complete
9c0f1dffe039: Pull complete
474314d81831: Pull complete
90ee5d998c5c: Pull complete
a79c7e2a85e1: Pull complete
1e48dd1bb576: Pull complete
Digest: sha256:ad82afe54f2aa67167e873162578a751aed3173e42250a9ed68f306aa4b83025
Status: Downloaded newer image for tomcat:latest
docker.io/library/tomcat:latest
3、啟動執行
[root@MiWiFi-R3600-srv /]# docker run -d -p 3355:8080 --name tomcat tomcat
4742f46da97851499036b5c19e147e359263ebf7c57704c5c09c685d08252153
4、測試訪問: http://ip:3355 沒有問題但是未出現tomcat訪問頁
5、進入容器檢視
# 進入容器
[root@MiWiFi-R3600-srv ~]# docker exec -it tomcat /bin/bash
root@5817301c4b17:/usr/local/tomcat# ls
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE README.md RELEASE-NOTES RUNNING.txt bin conf lib logs native-jni-lib temp webapps webapps.dist work
root@5817301c4b17:/usr/local/tomcat# cd /usr/l
lib/ local/
root@5817301c4b17:/usr/local/tomcat# cd /usr/local/tomcat/webapps
# 發現問題:1.linux命令少了。2.沒有webapps。阿里雲映象原因,預設最小的映象,所有不必要的都剔除掉。包拯最小可執行的環境。
root@5817301c4b17:/usr/local/tomcat/webapps# ls
root@5817301c4b17:/usr/local/tomcat/webapps# cd ..
# 檢視tomcat資料夾 此時會發現tomcat資料夾下有webapps.dist資料夾
root@5817301c4b17:/usr/local/tomcat# ls
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE README.md RELEASE-NOTES RUNNING.txt bin conf lib logs native-jni-lib temp webapps webapps.dist work
root@5817301c4b17:/usr/local/tomcat# cd webapps.dist/
# 檢視 webapps.dist 並將 webapps.dist 下檔案 複製到 webapps
root@5817301c4b17:/usr/local/tomcat/webapps.dist# ls
ROOT docs examples host-manager manager
root@5817301c4b17:/usr/local/tomcat/webapps.dist# cd ..
root@5817301c4b17:/usr/local/tomcat# cp -r webapps.dist/* webapps
root@5817301c4b17:/usr/local/tomcat# cd webapps
root@5817301c4b17:/usr/local/tomcat/webapps# ls
ROOT docs examples host-manager manager
6、再測試訪問: http://ip:3355 tomcat訪問頁出現
[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片儲存下來直接上傳(img-edzx3gyO-
7、下面建立資料夾方便進行對映,準備配置檔案
建立資料夾
mkdir -p /data/docker/tomcat/
複製配置檔案
docker cp tomcat:/usr/local/tomcat/webapps /data/docker/tomcat
8、準備工作
#停止
docker stop tomcat
#刪除
docker rm tomcat
9、重新執行掛載
docker run -d -p 3355:8080 --name tomcat -v /data/docker/tomcat/webapps:/usr/local/tomcat/webapps --restart=always tomcat
10、再測試訪問: http://ip:3355 tomcat訪問頁出現
安裝成功
相關文章
- docker 安裝tomcatDockerTomcat
- docker使用大全 tomcat安裝DockerTomcat
- Docker安裝+HelloWorld+執行TomcatDockerTomcat
- [第二十篇]——Docker 安裝 TomcatDockerTomcat
- 『現學現忘』Docker基礎 — 23、使用Docker安裝TomcatDockerTomcat
- Centos7安裝jenkins+docker部署tomcatCentOSJenkinsDockerTomcat
- 使用docker搭建環境:安裝tomcat、部署war包DockerTomcat
- Tomcat安裝Tomcat
- Ubuntu下啟用docker並安裝mysql|redis|tomcat|rapUbuntuDockerMySqlRedisTomcat
- 安裝dockerDocker
- 安裝 dockerDocker
- docker 安裝Docker
- tomcat安裝使用Tomcat
- Tomcat配置安裝Tomcat
- apache tomcat 安裝ApacheTomcat
- tomcat之 JDK8.0安裝、tomcat-8.5.15安裝TomcatJDK
- docker安裝及解除安裝Docker
- Tomcat 8安裝部署Tomcat
- window下tomcat安裝Tomcat
- linux安裝tomcatLinuxTomcat
- Tomcat安裝指令碼Tomcat指令碼
- centos下安裝tomcatCentOSTomcat
- Tomcat之一:安裝Tomcat
- mac下安裝TomcatMacTomcat
- Tomcat安裝與配置Tomcat
- tomcat 下安裝 MantisBTTomcat
- Mac 下安裝tomcatMacTomcat
- docker 安裝 RabbitMQDockerMQ
- docker 安裝 PHPDockerPHP
- docker安裝使用Docker
- Docker安裝NacosDocker
- docker 安裝 mysqlDockerMySql
- Docker安裝mongodbDockerMongoDB
- Docker安裝PortainerDockerAI
- docker安裝harborDocker
- redhat安裝dockerRedhatDocker
- Docker安裝JanusGraphDocker
- docker安裝zookeeperDocker