Is it possible for image to have multiple tags?

前端 未结 5 401
一整个雨季
一整个雨季 2021-02-02 05:45

When I am pushing new image to repo I would like it to have two tags for example 0.2 and latest. This would allow to always pull latest image version b

5条回答
  •  遥遥无期
    2021-02-02 06:02

    You can build an image with several tags and then push the image with the --all-tags option.

    Example:

    docker build -t reg/user/image:foo -t reg/user/image:latest .
    
    docker push reg/user/image --all-tags
    

    Older Docker clients that do not support --all-tags will push all tags by default (simply omit the option), newer clients will only push latest by default. As an alternative, you may want to push each tag separately.

提交回复
热议问题