[root@host-192-168-215-50 ~]# 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
[root@host-192-168-215-50 ~]# docker commit testnginx 192.168.215.50:4000/commitnginx
sha256:d35069d44ce34af37025878c63a1e0a4e1cf8836414acad06643686e20a27bf6
[root@host-192-168-215-50 ~]# 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
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
[root@host-192-168-215-50 ~]# docker commit testnginx
sha256:b3a4a0ff5fb6b85479faf6778d59999f1f76ea9df731d3a60d6036ca11b9b0ed
[root@host-192-168-215-50 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
b3a4a0ff5fb6 7 seconds ago 169MB
192.168.215.50:4000/commitnginx latest d35069d44ce3 25 seconds ago 169MB
192.168.215.50:4000/commitnginx
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
[root@host-192-168-215-50 ~]#
对同一个容器多次commit后,未指定REPOSITORY和TAG。docker默认会指定最新的latest。旧的images的tag就会更改为none了