创建镜像两种方式:
更新镜像: docker commit
构建镜像: docker build
更新镜像: 先更进基础镜像, 创建一个容器, 然后对容器进行修改, 最后 commit 命令提交
创建容器:$ sudo docker run --name mytomcat -p 8080:8080 -d tomcat:latest
进入容器:$ sudo docker exec -it 1c644e0a20b8 /bin/bash
修改容器启动页面: mv index.jsp index.jsp_bak \ echo welcome to tomcat> index.html
提交自定义镜像: docker commit -m=""-a="" 容器 ID 或名称 镜像名: tag
$ sudo docker commit -m="修改默认首页" -a="xianwei" 1c644e0a20b8 home/python:v1
运行自定义镜像
- $ sudo docker run --name tomcat_v1 -p 8090:8080 -d home/python:v1
来源: http://www.bubuko.com/infodetail-2894451.html