1. 程式人生 > >docker 建立一個新映象

docker 建立一個新映象

在原映象上,修改:

[[email protected] Desktop]# docker run -ti ubuntu /bin/bash
[email protected]:/# touch test
[email protected]:/# exit
exit
[[email protected] Desktop]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              ebcd9d4fca80        11 hours ago        117.9 MB

記住原映象的id:ac5b821c6242

進行提交,建立新映象:

[[email protected] Desktop]# docker commit -m "add a new file" -a "docker newbee" ac5b821c6242 test
sha256:3ab5471af4a3c79ff55a74de2b0a3b857c1ecf0bc515c50d11175c2779ab081f
[[email protected] Desktop]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
test                latest              3ab5471af4a3        6 seconds ago       117.9 MB
ubuntu              latest              ebcd9d4fca80        11 hours ago        117.9 MB