linux环境搭建之docker安装tomcat

此次安装,是基于Centos7.3版本,已安装Docker-ce!!!

1.pull一个tomcat

docker pull tomcat:8

2.使用Tomcat默认的配置来启动一个Tomcat容器

docker run -d -p 8082:8080 --name tomcat tomcat:8

3.创建Tomcat目录

mkdir -p /usr/local/tomcat

4.拷贝容器内Tomcat配置文件和日志到本地

docker cp tomcat:/usr/local/tomcat/conf /usr/local/tomcat/conf
docker cp tomcat:/usr/local/tomcat/logs /usr/local/tomcat/logs

5.停止并删除tomcat

docker stop tomcat
docker rmtomcat

6.创建并运行tomcat容器

docker run -itd --privileged=true -v /etc/localtime:/etc/localtime -v /usr/local/tomcat/webapps:/usr/local/tomcat/tomcat8/webapps -v /usr/local/tomcat/conf:/usr/local/tomcattomcat8//conf -v /usr/local/tomcat/logs:/usr/local/tomcat/tomcat8/logs -p 8082:8080 --name tomcat tomcat:8

7.tomcat登陆

http://ip:端口

8.执行过的history,不要怂直接复制

docker pull tomcat:8
docker run -d -p 8082:8080 --name tomcat tomcat:8
mkdir -p /usr/local/tomcat
docker cp tomcat:/usr/local/tomcat/conf /usr/local/tomcat/conf
docker cp tomcat:/usr/local/tomcat/logs /usr/local/tomcat/logs
docker stop tomcat
docker rmtomcat
docker run -itd --privileged=true -v /etc/localtime:/etc/localtime -v /usr/local/tomcat/webapps:/usr/local/tomcat/tomcat8/webapps -v /usr/local/tomcat/conf:/usr/local/tomcattomcat8//conf -v /usr/local/tomcat/logs:/usr/local/tomcat/tomcat8/logs -p 8082:8080 --name tomcat tomcat:8
http://ip:端口

你可能感兴趣的:(docker)