Docker安装Tomcat应用服务器
1、安装镜像
1. Install the image:
可以先到https://hub.docker.com/ 搜索镜像
You can get there first. https://hub.docker.com/ search mirror
或使用docker search 镜像名称
or use docker search image name
docker pull tomcat
2、查看验证下载好的镜像
docker images
3、启动tomcat
3. Start tomcat2. Check and verify the downloaded image.
-p : 8080 in front is the port of this machine, 8080 after the colon is the port of docker container, and tomcat is 8080 by default.
-d:后台运行
-i 启动这个容器
-t 容器创建成功后我们可以进入到容器中
-d: Run in background
--name : 是给容器起一个别名,方便使用,不然docker会默认给容器一个随机字符串的名称
--name : is to give an alias to the container for easy use, otherwise docker will give the container a random string name by default
-v 用来指定目录映射 --指定宿主机的某一个目录和容器中的某一个目录的对应关系
-p 用来指定端口映射 --指定宿主机的某一端口和容器中运行软件端口的对应关系:例如前边的8080是linux本机的端口,冒号后面的8080是docker容器的端口,tomcat默认是8080
-v: file mount path (not used in the above command)
docker run -it -d --name tomcat
-v /var/lib/docker/volumes/tomcat:/usr/local/tomcat/webapps
-v /var/lib/docker/volumes/tomcat:/usr/local/tomcat/logs
-v /usr/local/tomcat/conf:/usr/local/tomcat/conf -p 8080:8080 tomcat
4、查看tomcat安装位置
View tomcat installation location
docker exec -it tomcat /bin/bash
如果想得到容器更为详细信息,例如。挂载目录、tomcat版本等
(2) sudo docker inspect -f {{.State.Pid}} 44fc0f0582d9(2), and then get the full ID according to either of these two items.
docker inspect 容器ID
5、高版本的tomcat,默认把webapps下的测试应用移动到了webapps.dist
(3) Copy the file from the local to the docker container
cp -rf /usr/local/tomcat/webapps.dist/ROOT /usr/local/tomcat/webapps/ROOT
6、访问测试
原文出处【开源吧】:https://www.ossbar.com/#/platformConsultingDetails?newsId=186
最新文章
- c 网络与套接字socket
- jquery插件——点击交换元素位置(带动画效果)
- 打包.a 文件时, build phases- Link Binary With Libraries
- 你需要知道的Sass插值
- 有关JSP注释
- 对cocos2d 之autorelease\ratain\release的理解
- python编程中在ubuntu中安装虚拟环境及环境配置
- 看懂此文,不再困惑于 JS 中的事件设计
- 赵雅智_BroadcastReceiver电话监听
- PL/SQL Developer 连接Oracle数据库详细配置方法
- Linux向文件添加内容的几种方法
- Rhel-Server 5.5 安装ORACLE10
- Oracle 与 Mysql NULL值,空字符串''的区别
- Android Button四种点击事件和长按事件
- INTRODUCE OF REPRESENTATIVE CPG-CONTROLLED ROBOTS
- bash array
- [原][openstack-pike][controller node][issue-4][horizon] dashboard access too low reasons[dashboard 访问太慢]
- python3实现的rtsp客户端脚本
- HDU 5877 Weak Pair(树状数组+dfs+离散化)
- 关于ESXI5.0版本+ Broadcom BCM5720的BUG
热门文章
- Easy-Classification-验证码识别
- 解决redmi airdots 2右耳充不进电,灯不亮
- SSH ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor
- Jmeter启动报错: ANOMALY: use of REX.w is meaningless (default operand size is 64), Unrecognized option: --add-opens
- Microsoft.IO.RecyclableMemoryStream源码解读
- JavaEE Day14 Servlet&;HTTP&;Request
- 链接脚本中 AT>; 的作用
- 大角度非迭代的空间坐标旋转C#实现
- 关于jQuery的操作
- Flutter异常监控 - 壹 | 从Zone说起