想通过 docker 的 /bin/bash 修改容器内容,commit 新的 image 。
未成功的操作流程如下:
docker run -t -i docker-wordpress-nginx /bin/bash
进入容器bash
vi /etc/nginx/sites-available/default
修改了 nginx 的 conf 文件
exit
退出容器,然后运行
docker ps
什么都没有。运行
docker images
还是原来那些 images。
请问如何保存在 docker 中 bash 所做的修改,如何 commit?
PS1:如何 commit 给新的 image 自动打上 tag latest,并且之前的 latest 作废(替代)?
PS2:假如通过修改和 commit 得到三个版本 tag v1, v2, v3,能否删除 v1, v2 保留 v3?即单独的 images 之间有关联(堆叠)关系吗?
A1. If the commit is not tagged, it defaults to latest. If you modify the latest image and then commit without adding a tag, it will replace the original latest. Generally, you need to tag the original latest image before committing.
A2. v1, v2, v3 are all tags you added yourself.
docker rmi username/repo:v1
You can delete v1this tag without affecting other tagsAt the same time, if the three tags v1, v2, and v3 are on the same image id, deleting the v1 tag will not delete the corresponding image
View the container that was "just" run!
Then you get the container_id of the command you just ran
The default tag is latest
If the above answers are wrong, you will encounter problems! Still trying, please give me some answers and Best Practices!
Key combination: Ctrl+P+Q
Press Enter to jump out of the docker container without closing it. This is the solution for now.
http://blog.csdn.net/yangzhen...