Closed sverhagen closed 9 years ago
can you be more specific about the error you get when you try to include the version as part of the name? i am using the exact same setup and i am able to push the image w/o the latest tag being added.
<configuration>
<registry>registry.company.com</registry>
<images>
<image>
<name>${docker.image.name}</name>
<alias>${project.name}</alias>
<build>
<from>azul/zulu-openjdk:8</from>
<ports>
<port>8080</port>
<port>8585</port>
</ports>
<assembly>
<descriptor>assembly.xml</descriptor>
</assembly>
<command>/maven/startup.sh</command>
</build>
<run>
<env>
<JMX_HOST>${docker.bind.host}</JMX_HOST>
<JMX_PORT>8585</JMX_PORT>
</env>
<ports>
<port>${docker.bind.host}:8080:8080</port>
<port>${docker.bind.host}:8585:8585</port>
</ports>
<restartPolicy>
<name>always</name>
</restartPolicy>
</run>
</image>
</images>
</configuration>
and docker.image.name
is defined as
<docker.image.name>company/${project.artifactId}:${project.version}</docker.image.name>
Thanks for the info, I agree that your configuration looks not essentially different than mine. I'll play some more with it. I've updated the question (above) to include a bit more context of the plugin execution (i.e. all of the plugin execution). There's no more error than this on the console. I'll run -X
later, when I'm back at a decent Internet connection. Let me know if I can provide anything else to resolve this!
Here is the debug logging:
[INFO] --- docker-maven-plugin:0.11.3-SNAPSHOT:push (dockerize) @ artifactId ---
[DEBUG] Configuring mojo org.jolokia:docker-maven-plugin:0.11.3-SNAPSHOT:push from plugin realm ClassRealm[plugin>org.jolokia:docker-maven-plugin:0.11.3-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@5e875dee]
[DEBUG] Configuring mojo 'org.jolokia:docker-maven-plugin:0.11.3-SNAPSHOT:push' with basic configurator -->
[DEBUG] (f) apiVersion = v1.15
[DEBUG] (f) autoPull = true
[DEBUG] (f) name = company/artifactId:1.0.8-SNAPSHOT
[DEBUG] (f) alias = artifactId
[DEBUG] (f) registry = my-registry
[DEBUG] (f) from = java:8-jdk
[DEBUG] (f) ports = [7500]
[DEBUG] (f) command = java -jar /service/artifactId-1.0.8-SNAPSHOT.jar
[DEBUG] (f) basedir = /service
[DEBUG] (f) descriptorRef = artifact
[DEBUG] (f) assembly = org.jolokia.docker.maven.config.AssemblyConfiguration@36f94f72
[DEBUG] (f) build = org.jolokia.docker.maven.config.BuildImageConfiguration@29cee190
[DEBUG] (f) images = [ImageConfiguration{name='company/artifactId:1.0.8-SNAPSHOT', alias='artifactId'}]
[DEBUG] (f) project = MavenProject: com.company.service.artifactId:artifactId:1.0.8-SNAPSHOT @ E:\artifactId\provider\pom.xml
[DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@456a3360
[DEBUG] (f) skip = false
[DEBUG] (f) useColor = true
[DEBUG] -- end configuration --
[DEBUG] CookieSpec selected: best-match
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.56.101:2375][total kept alive: 0; route allocated: 0 of 10; total allocated: 0 of 20]
[DEBUG] Connection leased: [id: 1][route: {}->http://192.168.56.101:2375][total kept alive: 0; route allocated: 1 of 10; total allocated: 1 of 20]
[DEBUG] Opening connection {}->http://192.168.56.101:2375
[DEBUG] Connecting to /192.168.56.101:2375
[DEBUG] Connection established 192.168.56.1:57574<->192.168.56.101:2375
[DEBUG] Executing request GET /v1.15/images/json?filter=my-registry/company/artifactId HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-1 >> GET /v1.15/images/json?filter=my-registry/company/artifactId HTTP/1.1
[DEBUG] http-outgoing-1 >> Accept: */*
[DEBUG] http-outgoing-1 >> Content-Type: application/json
[DEBUG] http-outgoing-1 >> Host: 192.168.56.101:2375
[DEBUG] http-outgoing-1 >> Connection: Keep-Alive
[DEBUG] http-outgoing-1 >> User-Agent: Apache-HttpClient/4.3.6 (java 1.5)
[DEBUG] http-outgoing-1 >> Accept-Encoding: gzip,deflate
[DEBUG] http-outgoing-1 >> "GET /v1.15/images/json?filter=my-registry/company/artifactId HTTP/1.1[\r][\n]"
[DEBUG] http-outgoing-1 >> "Accept: */*[\r][\n]"
[DEBUG] http-outgoing-1 >> "Content-Type: application/json[\r][\n]"
[DEBUG] http-outgoing-1 >> "Host: 192.168.56.101:2375[\r][\n]"
[DEBUG] http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
[DEBUG] http-outgoing-1 >> "User-Agent: Apache-HttpClient/4.3.6 (java 1.5)[\r][\n]"
[DEBUG] http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]"
[DEBUG] http-outgoing-1 >> "[\r][\n]"
[DEBUG] http-outgoing-1 << "HTTP/1.1 200 OK[\r][\n]"
[DEBUG] http-outgoing-1 << "Content-Type: application/json[\r][\n]"
[DEBUG] http-outgoing-1 << "Date: Fri, 10 Apr 2015 07:20:31 GMT[\r][\n]"
[DEBUG] http-outgoing-1 << "Content-Length: 2[\r][\n]"
[DEBUG] http-outgoing-1 << "[\r][\n]"
[DEBUG] http-outgoing-1 << "[]"
[DEBUG] http-outgoing-1 << HTTP/1.1 200 OK
[DEBUG] http-outgoing-1 << Content-Type: application/json
[DEBUG] http-outgoing-1 << Date: Fri, 10 Apr 2015 07:20:31 GMT
[DEBUG] http-outgoing-1 << Content-Length: 2
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Connection [id: 1][route: {}->http://192.168.56.101:2375] can be kept alive indefinitely
[DEBUG] Connection released: [id: 1][route: {}->http://192.168.56.101:2375][total kept alive: 1; route allocated: 1 of 10; total allocated: 1 of 20]
[DEBUG] CookieSpec selected: best-match
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.56.101:2375][total kept alive: 1; route allocated: 1 of 10; total allocated: 1 of 20]
[DEBUG] Connection leased: [id: 1][route: {}->http://192.168.56.101:2375][total kept alive: 0; route allocated: 1 of 10; total allocated: 1 of 20]
[DEBUG] Stale connection check
[DEBUG] http-outgoing-1 << "[read] I/O error: Read timed out"
[DEBUG] Executing request POST /v1.15/images/company%2FartifactId/tag?repo=my-registry%2Fcompany%2FartifactId&tag=1.0.8-SNAPSHOT HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-1 >> POST /v1.15/images/company%2FartifactId/tag?repo=my-registry%2Fcompany%2FartifactId&tag=1.0.8-SNAPSHOT HTTP/1.1
[DEBUG] http-outgoing-1 >> Accept: */*
[DEBUG] http-outgoing-1 >> Content-Type: application/json
[DEBUG] http-outgoing-1 >> Content-Length: 0
[DEBUG] http-outgoing-1 >> Host: 192.168.56.101:2375
[DEBUG] http-outgoing-1 >> Connection: Keep-Alive
[DEBUG] http-outgoing-1 >> User-Agent: Apache-HttpClient/4.3.6 (java 1.5)
[DEBUG] http-outgoing-1 >> Accept-Encoding: gzip,deflate
[DEBUG] http-outgoing-1 >> "POST /v1.15/images/company%2FartifactId/tag?repo=my-registry%2Fcompany%2FartifactId&tag=1.0.8-SNAPSHOT HTTP/1.1[\r][\n]"
[DEBUG] http-outgoing-1 >> "Accept: */*[\r][\n]"
[DEBUG] http-outgoing-1 >> "Content-Type: application/json[\r][\n]"
[DEBUG] http-outgoing-1 >> "Content-Length: 0[\r][\n]"
[DEBUG] http-outgoing-1 >> "Host: 192.168.56.101:2375[\r][\n]"
[DEBUG] http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
[DEBUG] http-outgoing-1 >> "User-Agent: Apache-HttpClient/4.3.6 (java 1.5)[\r][\n]"
[DEBUG] http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]"
[DEBUG] http-outgoing-1 >> "[\r][\n]"
[DEBUG] http-outgoing-1 << "HTTP/1.1 404 Not Found[\r][\n]"
[DEBUG] http-outgoing-1 << "Content-Type: text/plain; charset=utf-8[\r][\n]"
[DEBUG] http-outgoing-1 << "Date: Fri, 10 Apr 2015 07:20:31 GMT[\r][\n]"
[DEBUG] http-outgoing-1 << "Content-Length: 55[\r][\n]"
[DEBUG] http-outgoing-1 << "[\r][\n]"
[DEBUG] http-outgoing-1 << "could not find image: no such id: company/artifactId[\n]"
[DEBUG] http-outgoing-1 << HTTP/1.1 404 Not Found
[DEBUG] http-outgoing-1 << Content-Type: text/plain; charset=utf-8
[DEBUG] http-outgoing-1 << Date: Fri, 10 Apr 2015 07:20:31 GMT
[DEBUG] http-outgoing-1 << Content-Length: 55
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Connection [id: 1][route: {}->http://192.168.56.101:2375] can be kept alive indefinitely
[DEBUG] Connection released: [id: 1][route: {}->http://192.168.56.101:2375][total kept alive: 1; route allocated: 1 of 10; total allocated: 1 of 20]
[ERROR] DOCKER> could not find image: no such id: company/artifactId (Not Found: 404)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:36 min
[INFO] Finished at: 2015-04-10T00:20:31-07:00
[INFO] Final Memory: 42M/332M
[INFO] ------------------------------------------------------------------------
[DEBUG] Connection manager is shutting down
[DEBUG] http-outgoing-1: Close connection
[ERROR] Failed to execute goal org.jolokia:docker-maven-plugin:0.11.3-SNAPSHOT:push (dockerize) on project artifactId: Unable to add tag [my-registry/company/artifactId:1.0.8-SNAPSHOT] to image [company/artifactId:1.0.8-SNAPSHOT] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jolokia:docker-maven-plugin:0.11.3-SNAPSHOT:push (dockerize) on project artifactId: Unable to add tag [my-registry/company/artifactId:1.0.8-SNAPSHOT] to image [company/artifactId:1.0.8-SNAPSHOT]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to add tag [my-registry/company/artifactId:1.0.8-SNAPSHOT] to image [company/artifactId:1.0.8-SNAPSHOT]
at org.jolokia.docker.maven.AbstractDockerMojo.execute(AbstractDockerMojo.java:127)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.jolokia.docker.maven.access.DockerAccessException: Unable to add tag [my-registry/company/artifactId:1.0.8-SNAPSHOT] to image [company/artifactId:1.0.8-SNAPSHOT]
at org.jolokia.docker.maven.access.DockerAccessWithHttpClient.tag(DockerAccessWithHttpClient.java:234)
at org.jolokia.docker.maven.access.DockerAccessWithHttpClient.tagTemporaryImage(DockerAccessWithHttpClient.java:343)
at org.jolokia.docker.maven.access.DockerAccessWithHttpClient.pushImage(DockerAccessWithHttpClient.java:211)
at org.jolokia.docker.maven.PushMojo.executeInternal(PushMojo.java:30)
at org.jolokia.docker.maven.AbstractDockerMojo.execute(AbstractDockerMojo.java:125)
... 21 more
[DEBUG] http-outgoing-1: Close connection
[ERROR]
[DEBUG] Connection manager shut down
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[DEBUG] Connection manager is shutting down
[DEBUG] http-outgoing-0: Close connection
[DEBUG] http-outgoing-0: Close connection
[DEBUG] Connection manager shut down
POST /v1.15/images/company%2FartifactId/tag?repo=my-registry%2Fcompany%2FartifactId&tag=1.0.8-SNAPSHOT HTTP/1.1[\r][\n]
It looks like the URL points to latest (implicitly), whereas I'd expect it to point to :1.0.8-SNAPSHOT
, such as: POST /v1.15/images/company%2FartifactId:1.0.8-SNAPSHOT/tag?...
. A latest may not have been built, as it uses this same configuration. I was trying to be specific about the version and not do latest, since the notion of "latest" doesn't mean much to much if there's all these different source code branches that we're running this for.
this may be a dumb question, but does the image actually exist in the registry? i don't see the actual push occurring anywhere in that output.
now that i look at your original output above, i don't see the actual image being built, i just see the tarball being created and then the plugin attempting to do the tag.
are you still trying to build w/ the tags
included or have you removed them and just added the version to the name?
You are right, I had messed up tags on the Docker Daemon, that prevented the "build" step from completing. My POM configuration then works:
<image>
<name>company/${project.artifactId}</name>
<alias>${project.artifactId}</alias>
<registry>my.registry.host</registry>
<build>
<tags>
<tag>${project.version}</tag>
</tags>
However, it then also pushes a latest tag.
When I change this to (pretty much your) configuration:
<image>
<name>company/${project.artifactId}</name>
<alias>${project.artifactId}</alias>
<registry>my.registry.host</registry>
<build>
<!-- no tags here -->
It then complains during the push:
[INFO] --- docker-maven-plugin:0.11.3-SNAPSHOT:build (dockerize) @ artifactId ---
[INFO] DOCKER> Creating image [company/artifactId:1.0.8-SNAPSHOT] "artifactId"
[INFO] Copying files to E:\service\provider\target\docker\company\artifactId\1.0.8-SNAPSHOT\build\maven
[INFO] Building tar: E:\service\provider\target\docker\company\artifactId\1.0.8-SNAPSHOT\tmp\docker-build.tar
[INFO]
[INFO] --- docker-maven-plugin:0.11.3-SNAPSHOT:push (dockerize) @ artifactId ---
[ERROR] DOCKER> could not find image: no such id: company/artifactId (Not Found: 404)
And:
[ERROR] Failed to execute goal org.jolokia:docker-maven-plugin:0.11.3-SNAPSHOT:push (dockerize) on project artifactId: Unable to add tag [my.registry.host/company/artifactId:1.0.8-SNAPSHOT] to image [company/artifactId:1.0.8-SNAPSHOT] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jolokia:docker-maven-plugin:0.11.3-SNAPSHOT:push (dockerize) on project artifactId: Unable to add tag [my.registry.host/company/artifactId:1.0.8-SNAPSHOT] to image [company/artifactId:1.0.8-SNAPSHOT]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to add tag [my.registry.host/company/artifactId:1.0.8-SNAPSHOT] to image [company/artifactId:1.0.8-SNAPSHOT]
at org.jolokia.docker.maven.AbstractDockerMojo.execute(AbstractDockerMojo.java:127)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.jolokia.docker.maven.access.DockerAccessException: Unable to add tag [my.registry.host/company/artifactId:1.0.8-SNAPSHOT] to image [company/artifactId:1.0.8-SNAPSHOT]
at org.jolokia.docker.maven.access.DockerAccessWithHttpClient.tag(DockerAccessWithHttpClient.java:234)
at org.jolokia.docker.maven.access.DockerAccessWithHttpClient.tagTemporaryImage(DockerAccessWithHttpClient.java:343)
at org.jolokia.docker.maven.access.DockerAccessWithHttpClient.pushImage(DockerAccessWithHttpClient.java:211)
at org.jolokia.docker.maven.PushMojo.executeInternal(PushMojo.java:30)
at org.jolokia.docker.maven.AbstractDockerMojo.execute(AbstractDockerMojo.java:125)
... 21 more
This particular exception occurs when trying to tag the wrong thing (I think), as I said here:
POST /v1.15/images/company%2FartifactId/tag?repo=my.registry.host%2Fcompany%2FartifactId&tag=1.0.8-SNAPSHOT HTTP/1.1
The Docker daemon tells me this: docker ps
:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
company/artifactId 1.0.8-SNAPSHOT a0dfc723e798 3 minutes ago 935.4 MB
It does work if I have an old latest in my Docker daemon, but that doesn't count. So before this test I docker rmi
all my (own) images.
Further to that, I think that /v1.15/images/company%2FartifactId/tag
should be /v1.15/images/company%2FartifactId:1.0.8-SNAPSHOT/tag
. This is being dealt with in the following method in UrlBuilder
:
public String tagContainer(ImageName source, ImageName target, boolean force) {
String url;
url = createUrl(String.format("/images/%s/tag", encode(source.getNameWithoutTag(null))));
...
When I change this as follows, it works for my narrow use case, but I'm sure there must be more to it:
url = createUrl(String.format("/images/%s:%s/tag", encode(source.getNameWithoutTag(null)), encode(source.getTag())));
hrm - i wonder if pushing to a registry requires a latest
tag as a kind of mandatory thing. something seems wrong here, but i'm not 100% sure what yet.
thinking about it, what difference does it make if a latest
tag gets pushed as long as your concrete version tag gets pushed w/ it? you can pull whatever image you need w/ the concrete version, you'd just always have an extra tag that points to whatever the latest build was?
btw: i can reproduce this myself and the docker api docs don't really give any clear indication of how this should work. the example request just looks like this:
POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
which to me indicates an implied latest
tag.
thinking about it, what difference does it make if a latest tag gets pushed as long as your concrete version tag gets pushed w/ it?
I have this unsubstantiated fear that different branch builds all pushing the same latest might run into concurrency issues. And then, it just doesn't make a lot of sense to me that each branch pushes and overwrites a latest of which the semantic meaning doesn't mean a whole lot then.
i don't disagree w/ that thought but as a 'until we figure out what the actual behavior should be' workaround (so to speak) given you said your fears are currently unsubstantiated.
it's clear you can do this w/ the docker client...so perhaps enabling debugging on the daemon side of things would let us see what's coming over the wire and then we could craft a fix (which may actually be what you suggested above)
I do not quite understand what the validation is that you'd like to get from monitoring the daemon. As a result I'm unsure how I can be of help in moving this forward?
FYI and FWIW, on the Docker registry I also see plenty examples where latest does not make a lot of semantic value. Sure, it marks the image that is pushed most-recently, but it does not represent the latest state of development per se.
i was hoping the daemon would indicate the url it got when you pushed via the command line so we could determine if the fix you suggested above will cover this or if the url should be changed in some other way.
are you still having this problem? as of 0.11.3 (and docker 1.6.0), i can't reproduce this.
I darkly remember that there was indeed an issue, but that should be fixed now. @sverhagen could you verify whether it works for you now ?
I just noted, when an image is named without a tag, and a push is used, then all images with different tags are pushed. I think, if the there is no tag, then idea the latest
should be pushed (since it also the one which has been build)
I'm sorry, this has all been a while ago, and I fail to even reproduce this now with 0.11.2. I'm using this configuration now, and no additional <tags>
:
<name>company/${project.artifactId}:${project.version}</name>
Ok. I will work on the overall registry to make the various ways consisten how a registry can be specified. I'll close that one for now, feel free to reopen in case.
thanks (and sorry for being a bit late ...).
One question from my side - is there possibility to disable lastest tag push if multiple tags are available?
<image>
<name>app-name</name>
<build>
<dockerFileDir>${project.basedir}/module_name</dockerFileDir>
<tags>
<tag>${envTag}</tag>
<tag>${project.version}</tag>
</tags>
</build>
</image>
Right now we'll have 3 tags (envTag, projectVersionTag, latest).
Actually, latest
will be always built, regardless what you specify in tags. Changing this behaviour is also not easily possible now, because of backwards compatibility.
But I agree that it would be more consistent that, if a <tags>
section is given, only these tags are created. One would need to add an extra latest
if this is desired.
We could introduce another option <impliciteLatestTag>false</impliciteLatestTag>
to avoid this. This would help also in a transition phase to a new major version where this is then set by default.
@MichalOrlowski just on a second though: You can always do a
<image>
<name>app-name:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/module_name</dockerFileDir>
<tags>
<tag>${envTag}</tag>
</tags>
</build>
</image>
This would solve your use case, as the latest
results only because you haven''t specified a tag in the name. Thinking again thats a better solution then the one I proposed above, as it works already now and is sufficiently clean enough ;-)
@rhuss - your solution is still pushing latest tag.
I think
Hmm, are you sure ? If you explicitly set the tags everywhere (in <image>
and in <tags>
), then there should be no latest
added automatically. If so, I think that's a bug. Could you provide a full example so that I could reproduce it ?
I don't want to introduce a tag if the use case can be already covered.
I have the same problem. Where I have multiple tags in the configuration and the latest always get pushed. Due to this when multiple jobs are running simultaneously and because we have big images , they end up failing due to the latest tag being created from multiple branches. Image xyz:latest could be pushed, but the temporary tag could not be removed and then the build fails. I dont see this problem if I only have one job running.
@rhuss Here's example.
<image>
<name>app:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/app-core</dockerFileDir>
<tags>
<tag>${envTag}</tag>
</tags>
</build>
</image>
~latest
seems to be always pushed, with no way to stop it in 0.24.0
.~
~Even with this configuration:~
~(mvn help:effective-pom
)~
(removed)
~And this output when building:~
(removed)
~And this output running with --debug
:~
~(mvn deploy
[d-m-p bound to package
phase])~
(removed)
~I still see the latest
tag being pushed:~
(removed)
~This is with version 0.24.0
. Previously, I had been using 0.16.9
with the "Trick" described here: https://github.com/fabric8io/docker-maven-plugin/issues/475#issuecomment-224343591 to avoid pushing latest
tags. This no longer works, and latest
is always pushed.~
EDIT: Was user error.
I had an <image>
defined in a parent pom, in full registry/name:tag
format. In an intermediate parent pom, I had a <pluginManagement>
block that was supposed to add configuration to that image but inadvertently set the <name>
to just registry/name
format (implicit 'latest' tag). This is why I was seeing latest
pushed.
It looks like older versions of the d-m-p
just ignored null tags and newer versions assume latest
. Now that I have fixed my configuration, I once again see only the explictly-defined tags in my <tags>
list (and the explicit tag from the image.name
block) pushed.
Sorry for the noise. Keep up the great work!
This is a question. Is it possible to build an image, as a specific version (tag), then push it, without pushing latest?
This is what I'm having so far, and it pushes both a latest and a (substituted)
${project.version}
.I've tried setting the tag directly:
But that just runs me into trouble:
And:
This may be a flaw yet into my understanding of Docker, but I'm trying to avoid latest to be pushed from every branch that is building this stuff, and we tend to represent the branches in the version name while in our CI environment. I am trying to avoid it in part because I think it has little meaning in my highly branched environment, but I'm also afraid for concurrency issues.