提交Docker镜像
docker pull tomcat //下载tomcat镜像

docker run -d --name="MyTomcat" -p 8888:8080 tomcat //后台方式,以外部主机端口8888映射容器端口8080,运行Tomcat,容器别名为MyTomcat

curl localhost:8888 //测试访问显示404
此处要注意,【有坑】!


docker exec -it 2dd5319e4047 /bin/bash //进入容器

cp -r webapps.dist/* webapps //将webapps.dist目录下的所以文件,拷贝到webapps目录

curl localhost:8888 //测试访问显示正常


docker commit --help //查看commit帮助
-a 作者
-m 提交的信息内容

docker commit -a "codingdgsun" -m "Init tomcat webapps" 27db1b0306bd mytomcat:1.0.0 //提交镜像,作者:codingdgsun;提交的备注信息:Init tomcat webapps;提交的镜像ID:27db1b0306bd;镜像的别名:mytomcat;版本号:1.0.0

网友评论