How do I make a Docker hub use the same image for “latest” and “vX.Y”?

巧了我就是萌 提交于 2019-12-05 22:43:00

Latest is just “the last build/tag that ran without a specific tag/version specified”.

If you push a tagged image it does not replace the current image tagged with latest. If you push tagged images only, latest tag is not added.

Automated Builds on Docker Hub is adding the latest tag automatically for the master branch.

With a little magic, Docker Hub can do this! Pablo Chico de Guzmán helped me out.

Steps:

  1. add a file called hooks/post_push
  2. make hooks/post_push executable, commit and push
  3. delete the "Branch" build, but leave the "Tag" build in place

Now, any tags I push (e.g. git push --tags) fire off an automated build, and the same image is also given the latest tag.

Here's the change I had to make so the most recent "vX.Y"-tagged meonkeys/syncthing image is also tagged latest.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!