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.

Latest tag is always pushed, even when not specified

See original GitHub issue

Description

I want to publish only a tag with the project version. However, an latest tag is always pushed.

I believe this is caused by https://github.com/fabric8io/docker-maven-plugin/blob/3118642fb47024830dcf1e29aea2f2e173bc6e9f/src/main/java/io/fabric8/maven/docker/service/RegistryService.java#L62-L64 For docker based builds, there is always the latest pushed.

For jib based builds, only the configured tags are pushed: https://github.com/fabric8io/docker-maven-plugin/blob/3118642fb47024830dcf1e29aea2f2e173bc6e9f/src/main/java/io/fabric8/maven/docker/service/JibBuildService.java#L87-L98

My configuration:

<plugin>
				<groupId>io.fabric8</groupId>
				<artifactId>docker-maven-plugin</artifactId>
				<version>0.37.0</version>
				<extensions>true</extensions>
				<configuration>
					<imagePullPolicy>Always</imagePullPolicy>
					<images>
						<image>
							<name>${docker.name}</name>
							
							<build>
								<dockerFile>src/main/docker/Dockerfile</dockerFile>
								<contextDir>${project.basedir}</contextDir>
                                                                <tags>
									<tag>${project.version}</tag>
								</tags>
							</build>
						</image>
					</images>
				</configuration>
				<executions>
					<execution>
						<id>build-image</id>
						<phase>package</phase>
						<goals>
							<goal>build</goal>
						</goals>
					</execution>
					<execution>
						<id>push</id>
						<phase>deploy</phase>
						<goals>
							<goal>push</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

Info

  • docker-maven-plugin version : 0.37.0
  • Maven version (mvn -v) : Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: C:\eclipse\tools\apache-maven\bin.. Java version: 17, vendor: Eclipse Adoptium, runtime: C:\eclipse\tools\java\17 Default locale: de_DE, platform encoding: Cp1252 OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”

  • Docker version : Docker version 20.10.8, build 3967b7d
  • If it’s a bug, how to reproduce : Create a new project, and push an image using the config above. Only the project.version is specified, but latest tag is still pushed.
  • Sample project : [GitHub Clone URL]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
rohanKanojiacommented, Dec 15, 2021

@Postremus : Thanks a lot! Once we merge I’ll cut a patch release maybe today or tomorrow.

1reaction
Postremuscommented, Dec 15, 2021

Yep. Will create a revert pr this evening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's Wrong With The Docker :latest Tag? - vsupalov.com
Latest is Just a Tag​​ Some people expect that :latest always points to the most-recently-pushed version of an image. That's not true. It's...
Read more >
The misunderstood Docker tag: latest | by Marc Campbell
Latest is just a tag with a special name. It doesn't mean anything special unless you use a pretty specific build/tag/push/pull/run pattern. “ ......
Read more >
Automatic Latest tag in private docker registry - Stack Overflow
When pushing an image to dockerHub it gets assigned automatically the latest tag so you can always access the newest image with that...
Read more >
Create Tag Retention Rules - Harbor docs
Enter the number of days to retain images, keeping only the ones that have been pulled during this period. There is no maximum...
Read more >
A quick introduction to Docker tags - freeCodeCamp
Alright, now let's uncover what happens when you don't specify a tag while tagging an image. This is where the latest tag comes...
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