zoukankan      html  css  js  c++  java
  • 【原创】运维基础之Docker(7)关于docker latest tag

    Docker images have a tag named latest which doesn’t work as you expect.
    Latest is just a tag with a special name.
    “Latest” simply means “the last build/tag that ran without a specific tag/version specified”.
    Just version your tags. Every time.

    docker image有一个tag叫做latest,latest通过最近一次没有指定版本的build或tag来生成

    下面实验来看:

    $ docker tag imagename localhost:5000/imagename
    $ docker push localhost:5000/imagename

    这样可以在repository上创建一个版本为latest的imagename,下一次更新操作如下:

    1)先停止使用旧的image的container并删除,然后删除旧的image

    $ docker stop $container_id
    $ docker rm $container_id
    $ docker rmi localhost:5000/imagename

    2)同上

    $ docker tag imagename localhost:5000/imagename
    $ docker push localhost:5000/imagename

    这种方式不会保留历史版本;

    更好的做法是:

    1)版本1

    $ docker tag imagename localhost:5000/imagename:1
    $ docker push localhost:5000/imagename:1
    $ docker tag imagename localhost:5000/imagename
    $ docker push localhost:5000/imagename

    这时latest=1

    2)版本2

    $ docker tag imagename localhost:5000/imagename:2
    $ docker push localhost:5000/imagename:2

    $ docker stop $container_id
    $ docker rm $container_id
    $ docker rmi localhost:5000/imagename
    $ docker tag imagename localhost:5000/imagename
    $ docker push localhost:5000/imagename

    这时latest=2


    参考:
    https://medium.com/@mccode/the-misunderstood-docker-tag-latest-af3babfd6375
    https://stackoverflow.com/questions/39352186/update-a-docker-image-in-registry

  • 相关阅读:
    给你的博客园加个面板娘!
    idea实现简单热部署
    idea 上传svn忽略文件
    谈一谈AOP面向切面编程
    做一个自定义注解
    使用aop切面编写日志模块
    数据结构之链表
    数据结构之队列
    数据结构之栈
    数据结构之线性表
  • 原文地址:https://www.cnblogs.com/barneywill/p/10601978.html
Copyright © 2011-2022 走看看