question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not tag every image with latest

See original GitHub issue

Description

Currently, every image that is built with d-m-p is automatically tagged with <image_name>:latest. When adding a <tags> section to the <build> section in the pom.xml, the newly built image is additionally tagged with the given tags, but it will still be tagged with latest.

My problem is, when running docker:build and docker:push, both latest and the additional tags will be pushed to the registry. In my case I do not want the latest tag to be pushed, only the additional tags.

I already looked at the source code, unfortunately the tagging with latest is, as far as I can tell, happening in UrlBuilder#buildImage() where a “t” parameter is added to the build command. Therefore it is not possible to disable the tagging with latest without modifying the code of d-m-p.

Info

  • d-m-p version : 0.31.0
  • Maven version (mvn -v) : 3.5.4
  • Docker version : Docker version 19.03.1, build 74b1e89e8a

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
rhusscommented, Oct 8, 2019

Currently, every image that is built with d-m-p is automatically tagged with <image_name>:latest. When adding a section to the section in the pom.xml, the newly built image is additionally tagged with the given tags, but it will still be tagged with latest.

No, an image is not unconditionally tagged always with latest, you can (and should) specify a tag as part of the image <name> and only use <tags> for additional tags.

How does you configuration look like ?

1reaction
Postremuscommented, Mar 11, 2022

@DimitriosSG @rohanKanojia This is the same use case I had in mind with #1495. I even provided a few PRs to change this behaviour, which in the end we had to revert.

There is a simple solution, which is not really documented though (afaik).

When specifying the image name as name>${docker.name}</name>, latest is assumed. You can change this behaviour though, by specifying the default tag like name>${docker.name}:${project.version}</name>. This is what we are using in our projects right now, and works without a flaw.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's Wrong With The Docker :latest Tag? - vsupalov.com
If you push a new image with a tag which is neither empty nor 'latest', :latest will not be affected or created. $...
Read more >
The misunderstood Docker tag: latest | by Marc Campbell
If you are shipping Docker images to a production environment, you should just ignore the latest tag. Don't use it. Don't be tempted...
Read more >
Docker remove <none> TAG images - Stack Overflow
You can try and list only untagged images (ones with no labels, or with label with no tag): docker images -q -a |...
Read more >
Why can't I pull the newest image by using the latest tag?
The latest tag is applied by default to reference an image when you run Docker commands without specifying the tag value. The latest...
Read more >
Docker Tagging: Best practices for tagging and versioning ...
Whenever you pull the stable tag, you should get the latest OS & Framework patched image. I say should as not all repo...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found