[root@dyw219 ~]# docker images centos REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE centos latest ee2526f4865b 5 months ago 201.8 MB
[root@dyw219 ~]# docker run -it centos /bin/bash
[root@0d30277f64dd /]# echo 'test' > myfile [root@0d30277f64dd /]# cat myfile test [root@0d30277f64dd /]# exit exit
-m 提定說明訊息,0d30277f64dd 是修改映像檔時的容器 ID。
[root@dyw219 ~]# docker commit -m "Added myfile" 0d30277f64dd centos:myfile 25f7f65b6de07afa47fd0bbd058615f84d80ab8e18b4a17b8c24ec8e62d26a46
[root@dyw219 ~]# docker images centos REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE centos myfile 25f7f65b6de0 4 minutes ago 201.8 MB centos latest ee2526f4865b 5 months ago 201.8 MB
[root@dyw219 ~]# docker run -it centos:myfile /bin/bash
[root@b78979b48165 /]# cat myfile test [root@b78979b48165 /]# exit exit