level 2
淡薄心境
楼主
下面那是我详细的操作步骤:
-------------------步骤1 查看当前所有的镜像-----------------------------
[root@localhost dev]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
tomcat latest 53ea00bc398f 5 weeks ago 350 MB
centos 1.0 60e65a8e4030 7 weeks ago 196.6 MB
-------------------步骤2,启动容器centos:1.0,并新增一些目录和文件-----------------------------
[root@localhost dev]# docker run -i -t --name centos1.0 centos:1.0 /bin/bash
[root@43fa193cabd2 /]# cd dev
[root@43fa193cabd2 dev]# mkdir abc
[root@43fa193cabd2 dev]#
[root@43fa193cabd2 dev]# cd abc
[root@43fa193cabd2 abc]# touch aaa.txt
[root@43fa193cabd2 abc]# vi aaa.txt
[root@43fa193cabd2 abc]# exit
exit
-------------------步骤3 查看刚才那个容器的ID-----------------------------
[root@localhost dev]# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
43fa193cabd2 centos:1.0 "/bin/bash" 52 seconds ago Exited (0) 14 seconds ago centos1.0
-------------------步骤4 根据刚才那个容器的ID,commit一个新的镜像centos:2.0-----------------------------
[root@localhost dev]# docker commit 43fa193cabd2 centos:2.0
547fab3341a37d912d29e80d6776967fbe4ed5d0b561fdd0687a484bb8eba443
-------------------步骤5 根据新的镜像centos:2.0启动一个容器,查看修改内容-----------------------------
[root@localhost dev]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos 2.0 547fab3341a3 6 seconds ago 196.6 MB
tomcat latest 53ea00bc398f 5 weeks ago 350 MB
centos 1.0 60e65a8e4030 7 weeks ago 196.6 MB
[root@localhost dev]# docker run -i -t --name centos2 centos:2.0 /bin/bash
[root@3e3929fd59e0 /]# cd dev
[root@3e3929fd59e0 dev]# ls
console fd full fuse kcore mqueue null ptmx pts random shm stderr stdin stdout tty urandom zero
//最后发现新容器的/dev/目录下没有之前创建的abc/aaa.txt。
//请问是为什么会这样?
//为这个问题忙了一整天了,心都碎了!
2016年02月18日 11点02分
1
-------------------步骤1 查看当前所有的镜像-----------------------------
[root@localhost dev]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
tomcat latest 53ea00bc398f 5 weeks ago 350 MB
centos 1.0 60e65a8e4030 7 weeks ago 196.6 MB
-------------------步骤2,启动容器centos:1.0,并新增一些目录和文件-----------------------------
[root@localhost dev]# docker run -i -t --name centos1.0 centos:1.0 /bin/bash
[root@43fa193cabd2 /]# cd dev
[root@43fa193cabd2 dev]# mkdir abc
[root@43fa193cabd2 dev]#
[root@43fa193cabd2 dev]# cd abc
[root@43fa193cabd2 abc]# touch aaa.txt
[root@43fa193cabd2 abc]# vi aaa.txt
[root@43fa193cabd2 abc]# exit
exit
-------------------步骤3 查看刚才那个容器的ID-----------------------------
[root@localhost dev]# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
43fa193cabd2 centos:1.0 "/bin/bash" 52 seconds ago Exited (0) 14 seconds ago centos1.0
-------------------步骤4 根据刚才那个容器的ID,commit一个新的镜像centos:2.0-----------------------------
[root@localhost dev]# docker commit 43fa193cabd2 centos:2.0
547fab3341a37d912d29e80d6776967fbe4ed5d0b561fdd0687a484bb8eba443
-------------------步骤5 根据新的镜像centos:2.0启动一个容器,查看修改内容-----------------------------
[root@localhost dev]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos 2.0 547fab3341a3 6 seconds ago 196.6 MB
tomcat latest 53ea00bc398f 5 weeks ago 350 MB
centos 1.0 60e65a8e4030 7 weeks ago 196.6 MB
[root@localhost dev]# docker run -i -t --name centos2 centos:2.0 /bin/bash
[root@3e3929fd59e0 /]# cd dev
[root@3e3929fd59e0 dev]# ls
console fd full fuse kcore mqueue null ptmx pts random shm stderr stdin stdout tty urandom zero
//最后发现新容器的/dev/目录下没有之前创建的abc/aaa.txt。
//请问是为什么会这样?
//为这个问题忙了一整天了,心都碎了!