步骤:
1、先从Docker HUB中摘取最新版本的tomcat镜像: docker image pull tomcat
2、创建临时tomcat容器: docker container run -d --name tomcat_temp tomcat
3、将tomcat_temp容器中tomcat的配置路径拷贝到所在主机:
docker container cp tomcat_temp:/usr/local/tomcat/webapps webapps
docker container cp tomcat_temp:/usr/local/tomcat/conf conf
docker container cp tomcat_temp:/usr/local/tomcat/logs logs
4、删除临时tomcat容器:docker container rm -f tomcat_temp
5、创建正式tomcat容器:docker container run -d -p 8080:8080 --name hqcms -v /root/docker/tomcat/webapps:/usr/local/tomcat/webapps -v /root/docker/tomcat/conf:/usr/local/tomcat/conf -v /root/docker/tomcat/logs:/usr/local/tomcat/logs -v
6、复制配置文件:docker container cp config.properties tomcat:/root/conf/config.properties