docker commit由執行的容器commit為映象
阿新 • • 發佈:2018-12-26
[[email protected] ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1c220f2bcedc ae513a47849c "nginx -g 'daemon of…" 18 hours ago Up 18 minutes 0.0.0.0:8088->80/tcp testnginx
0d344b0560fe d1fd7d86a825 "/entrypoint.sh /etc…" 20 hours ago Up 18 minutes 0.0.0.0:4000->5000/tcp registry
[ [email protected] ~]# docker commit testnginx 192.168.215.50:4000/commitnginx
sha256:d35069d44ce34af37025878c63a1e0a4e1cf8836414acad06643686e20a27bf6
[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.215.50:4000/commitnginx latest d35069d44ce3 6 seconds ago 169MB
192.168.215.50:4000/commitnginx <none> 1c6c5818d186 14 hours ago 169MB
192.168.215.50:4000/testnginx latest 28186c7bdf77 17 hours ago 169MB
192.168.215.50:4000/some-content-nginx latest 1f5aabb668b8 19 hours ago 308MB
some-content-nginx latest 1f5aabb668b8 19 hours ago 308MB
nginx latest ae513a47849c 4 weeks ago 109MB
nginx latest ae513a47849c 4 weeks ago 109MB
registry latest d1fd7d86a825 4 months ago 33.3MB
[ [email protected] ~]# docker commit testnginx
sha256:b3a4a0ff5fb6b85479faf6778d59999f1f76ea9df731d3a60d6036ca11b9b0ed
[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> b3a4a0ff5fb6 7 seconds ago 169MB
192.168.215.50:4000/commitnginx latest d35069d44ce3 25 seconds ago 169MB
192.168.215.50:4000/commitnginx <none> 1c6c5818d186 14 hours ago 169MB
192.168.215.50:4000/testnginx latest 28186c7bdf77 17 hours ago 169MB
some-content-nginx latest 1f5aabb668b8 19 hours ago 308MB
192.168.215.50:4000/some-content-nginx latest 1f5aabb668b8 19 hours ago 308MB
nginx latest ae513a47849c 4 weeks ago 109MB
nginx latest ae513a47849c 4 weeks ago 109MB
registry latest d1fd7d86a825 4 months ago 33.3MB
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1c220f2bcedc ae513a47849c "nginx -g 'daemon of…" 18 hours ago Up 18 minutes 0.0.0.0:8088->80/tcp testnginx
0d344b0560fe d1fd7d86a825 "/entrypoint.sh /etc…" 20 hours ago Up 18 minutes 0.0.0.0:4000->5000/tcp registry
[
sha256:d35069d44ce34af37025878c63a1e0a4e1cf8836414acad06643686e20a27bf6
[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.215.50:4000/commitnginx latest d35069d44ce3 6 seconds ago 169MB
192.168.215.50:4000/commitnginx <none>
192.168.215.50:4000/testnginx latest 28186c7bdf77 17 hours ago 169MB
192.168.215.50:4000/some-content-nginx latest 1f5aabb668b8 19 hours ago 308MB
some-content-nginx latest 1f5aabb668b8 19 hours ago 308MB
nginx latest ae513a47849c 4 weeks ago 109MB
nginx latest ae513a47849c 4 weeks ago 109MB
registry latest d1fd7d86a825 4 months ago 33.3MB
[
sha256:b3a4a0ff5fb6b85479faf6778d59999f1f76ea9df731d3a60d6036ca11b9b0ed
[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> b3a4a0ff5fb6 7 seconds ago 169MB
192.168.215.50:4000/commitnginx latest d35069d44ce3 25 seconds ago 169MB
192.168.215.50:4000/commitnginx <none> 1c6c5818d186 14 hours ago 169MB
192.168.215.50:4000/testnginx latest 28186c7bdf77 17 hours ago 169MB
some-content-nginx latest 1f5aabb668b8 19 hours ago 308MB
192.168.215.50:4000/some-content-nginx latest 1f5aabb668b8 19 hours ago 308MB
nginx latest ae513a47849c 4 weeks ago 109MB
nginx latest ae513a47849c 4 weeks ago 109MB
registry latest d1fd7d86a825 4 months ago 33.3MB
[[email protected] ~]#
對同一個容器多次commit後,未指定REPOSITORY和TAG。docker預設會指定最新的latest。舊的images的tag就會更改為none了