docker commit由运行的容器commit为镜像

[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          <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
[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
<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

[root@host-192-168-215-50 ~]# 


对同一个容器多次commit后,未指定REPOSITORY和TAG。docker默认会指定最新的latest。旧的images的tag就会更改为none了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值