<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Maven on Roland Huß</title><link>https://ro14nd.de/tags/maven/</link><description>Recent content in Maven on Roland Huß</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>© 2026 Roland Huß</copyright><lastBuildDate>Wed, 11 Jul 2018 00:00:00 +0000</lastBuildDate><atom:link href="https://ro14nd.de/tags/maven/index.xml" rel="self" type="application/rss+xml"/><item><title>First look at Jib</title><link>https://ro14nd.de/jib-vs-dmp/</link><pubDate>Wed, 11 Jul 2018 00:00:00 +0000</pubDate><guid>https://ro14nd.de/jib-vs-dmp/</guid><description>&lt;p&gt;As soon as Google&amp;rsquo;s blog post &lt;a href="https://cloudplatform.googleblog.com/2018/07/introducing-jib-build-java-docker-images-better.html" target="_blank" rel="noreferrer"&gt;&amp;ldquo;Introducing Jib — build Java Docker images better&amp;rdquo;&lt;/a&gt; was online, all my channels went crazy about &lt;a href="https://github.com/GoogleContainerTools/jib" target="_blank" rel="noreferrer"&gt;Jib&lt;/a&gt;.
That was a bit surprising as Jib was started over one year ago but with this blog post this project rockets with more than 1000 new GitHub stars within one day. Crazy.&lt;/p&gt;
&lt;p&gt;I got a lot asked yesterday how Jib compares to &lt;a href="https://github.com/fabric8io/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;fabric8io/docker-maven-plugin&lt;/a&gt; (d-m-p) or &lt;a href="https://github.com/fabric8io/fabric8-maven-plugin" target="_blank" rel="noreferrer"&gt;fabric8io/fabric8-maven-plugin&lt;/a&gt; which includes d-m-p.&lt;/p&gt;
&lt;p&gt;Let me try to shed some light on the differences and pro and cons of both approaches.&lt;/p&gt;

&lt;h2 class="relative group"&gt;How Jib works
 &lt;div id="how-jib-works" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-jib-works" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s first have a quick look what Jib offers today and what makes it unique.&lt;/p&gt;
&lt;p&gt;Looking at the Jib Maven plugin it currently supports three goals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;jib:dockerBuild&lt;/code&gt; for assembling an image and loading it to a Docker daemon.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;jib:build&lt;/code&gt; for assembling the image and pushing it to a Docker registry.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;jib:exportDockerContext&lt;/code&gt; for creating a Dockerfile along with all the files required for performing a build against a Docker daemon.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The unique asset of Jib is that it does all of this &lt;em&gt;without consulting a Docker daemon&lt;/em&gt; by creating all image layers and metadata locally, conforming to either the Docker or OCI format.
And that all directly with plain Java code.&lt;/p&gt;
&lt;p&gt;Also, Jib assumes a very opinionated project setup with a so-called &lt;em&gt;flat classpath app&lt;/em&gt; with main class, dependencies and resources all in different artefacts.
Compare this to &lt;em&gt;fat jars&lt;/em&gt; popularised by Spring Boot, where the application code, resources and dependencies are all stored in the same jar file.
There are some drawbacks of flat classpath app, but one benefit is, that you can organise the various files into several layers in your image, putting the one which is changing less (like dependencies) at the bottom of the layer stack.
That&amp;rsquo;s what Jib does: It puts all dependency jars into one layer, all resource files (like property files to be loaded from the classpath) in another and the application classes into a third layer.
All of these layers get aggressively cached locally.
That way, you can be much faster when recreating images than with fat jars which apparently can be stored only in one single layer.&lt;/p&gt;
&lt;p&gt;But let&amp;rsquo;s have a look how Jib works in detail. The steps performed by a &lt;code&gt;jib:dockerBuild&lt;/code&gt; or &lt;code&gt;jib:build&lt;/code&gt; are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Fetch base image&amp;rsquo;s layers and cache them locally. By default the base image is &lt;code&gt;gcr.io/distroless/java&lt;/code&gt;, but this can be configured.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create three application image layers for&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Dependencies&lt;/li&gt;
&lt;li&gt;Resources&lt;/li&gt;
&lt;li&gt;Classes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since these layers are cached, if any of them doesn&amp;rsquo;t change (which is likely for dependencies), then the layer is not recreated.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create the application image locally. The two previous steps were performed asynchronously; this step continues when both previous steps have been finished. The &lt;code&gt;ENTRYPOINT&lt;/code&gt; of this image is fixed set to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; java &amp;lt;jvm-flags&amp;gt; -cp dep_dir/*:resource_dir/:class_dir/ &amp;lt;main-class&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;where &lt;code&gt;&amp;lt;jvm-flags&amp;gt;&lt;/code&gt; can optionally be configured and &lt;code&gt;&amp;lt;main-class&amp;gt;&lt;/code&gt; is the mandatory main class to specify. The information leading to the classpath comes from the underlying Maven or Gradle project information. Also, any Java arguments configured to become the &lt;code&gt;CMD&lt;/code&gt; of the image, as well the exposed ports (&lt;code&gt;EXPOSE&lt;/code&gt;) can be added, too.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Finally the local image layers along with its meta-data is tarred up, and either loaded into a Docker daemon or pushed to a Docker registry.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 class="relative group"&gt;How does Jib compare to d-m-p ?
 &lt;div id="how-does-jib-compare-to-d-m-p-" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-does-jib-compare-to-d-m-p-" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Jib is impressive for the use case it supports and brings a fresh spin to the way how Java apps can be packaged into Docker images.&lt;/p&gt;
&lt;p&gt;The most significant benefits of Jib are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fast for incremental builds when you have a &lt;em&gt;flat classpath application&lt;/em&gt;, resulting in three different layers for dependencies, resources and your application classes.&lt;/li&gt;
&lt;li&gt;No Docker daemon required, which reduces the build requirements and increases security because the image creation happens without root permissions.&lt;/li&gt;
&lt;li&gt;Produces reproducible images by wiping out file owner and modifications date. However, not sure whether e.g. generated timestamps in resource files like properties are wiped out, too.&lt;/li&gt;
&lt;li&gt;It supports both, Maven and Gradle.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However, there are also some limitations. Some of them might be tackled in the future, but other might not be changed due to the unique way how Jib works:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Can be only used for simple &lt;em&gt;flat classpath&lt;/em&gt; Java applications. There is currently no support for fat jars (i.e. Spring Boot fat jars) nor other packaging formats like WAR file.&lt;/li&gt;
&lt;li&gt;Simplistic startup of the application with a plain &lt;code&gt;java&lt;/code&gt; call instead of using a full features startup script like &lt;a href="https://github.com/fabric8io-images/run-java-sh" target="_blank" rel="noreferrer"&gt;run-java-sh&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;No additional files like configuration files outside the classpath or agents like &lt;code&gt;jmx_exporter&lt;/code&gt; agent can be added (but there is a &lt;a href="https://github.com/GoogleContainerTools/jib/pull/455" target="_blank" rel="noreferrer"&gt;PR&lt;/a&gt; pending for agents).&lt;/li&gt;
&lt;li&gt;Fixed classpath order, e.g. doesn&amp;rsquo;t allow for overwritten resources in dependencies as dependencies are always first on the classpath.&lt;/li&gt;
&lt;li&gt;Jib uses a custom XML configuration syntax instead of plain Dockerfile syntax (which I often heard as a major critique about d-m-p which also supports a custom XML configuration, but as alternative to Dockerfiles).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;d-m-p provides some additional features which are not supported by Jib, like&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Running containers for integration testing (that&amp;rsquo;s very likely the most prominent difference)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Dockerfile&lt;/code&gt; support&lt;/li&gt;
&lt;li&gt;&lt;code&gt;docker-compose.yml&lt;/code&gt; support&lt;/li&gt;
&lt;li&gt;Enhanced authentication support OpenShift and Amazon ECR support&lt;/li&gt;
&lt;li&gt;Support for watching code change and then automatically triggering a rebuild of images and restart of containers&lt;/li&gt;
&lt;li&gt;Support for arbitrary assembly and base images, including Spring Boot fat jar and JavaEE containers.&lt;/li&gt;
&lt;li&gt;Healthchecks&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And if you jump to &lt;a href="https://github.com/fabric8io/fabric8-maven-plugin" target="_blank" rel="noreferrer"&gt;fabric8-maven-plugin&lt;/a&gt;, which includes d-m-p for its image building business, you have even more high level features like a &lt;a href="https://maven.fabric8.io/#zero-config" target="_blank" rel="noreferrer"&gt;zero config&lt;/a&gt; mode which analyses your &lt;code&gt;pom.xml&lt;/code&gt; and selects opinionated defaults like base images and handcrafted startup scripts, depending on the type of tech stack you are using (like Spring Boot, Thorntail, Vert.x, Tomcat, &amp;hellip;)&lt;/p&gt;

&lt;h2 class="relative group"&gt;Next steps &amp;hellip;
 &lt;div id="next-steps-" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#next-steps-" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;This overview is only a quick glance on Jib. In one of the next posts, I plan to show some real-life examples and also measuring the performance gain by using Jib.&lt;/p&gt;
&lt;p&gt;Also, there a plans for d-m-p to add support for Jib backend and other daemonless build systems like &lt;a href="https://github.com/genuinetools/img" target="_blank" rel="noreferrer"&gt;img&lt;/a&gt;, &lt;a href="https://github.com/projectatomic/buildah" target="_blank" rel="noreferrer"&gt;buildah&lt;/a&gt; or &lt;a href="https://github.com/GoogleContainerTools/kaniko" target="_blank" rel="noreferrer"&gt;kaniko&lt;/a&gt;.
The mid to longterm plan is to enhance the build abstraction within d-m-p and offer, based on the Java project given, different ways to build images.&lt;/p&gt;
&lt;p&gt;BTW, if you are interested in what&amp;rsquo;s going on in Docker image building business these days, you probably might find this &lt;a href="https://www.youtube.com/watch?v=qhykcC94ukg" target="_blank" rel="noreferrer"&gt;KubeCon presentation&lt;/a&gt; as useful as I did. Daemonless FTW :)&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Psst, d-m-p also likes GitHub &lt;a href="https://github.com/fabric8io/docker-maven-plugin/stargazers" target="_blank" rel="noreferrer"&gt;★&lt;/a&gt; ;-)&lt;/em&gt;&lt;/p&gt;</description></item><item><title>docker-maven-plugin might be still useful</title><link>https://ro14nd.de/dmp-not-so-bad/</link><pubDate>Thu, 05 Jul 2018 00:00:00 +0000</pubDate><guid>https://ro14nd.de/dmp-not-so-bad/</guid><description>&lt;p&gt;Yesterday a blog post &lt;a href="https://codefresh.io/howtos/using-docker-maven-maven-docker/" target="_blank" rel="noreferrer"&gt;Using Docker from Maven and Maven from Docker&lt;/a&gt; by &lt;a href="https://twitter.com/codepipes" target="_blank" rel="noreferrer"&gt;Kostis Kapelonis&lt;/a&gt; was published which gives some insights on the possible relationships between Docker and Maven.
The article makes some essential points really, and gives an overview for the two remaining Docker Maven plugins as well as how &lt;a href="https://codefresh.io/" target="_blank" rel="noreferrer"&gt;Codefresh&lt;/a&gt; recommends doing Docker multi-stage builds as the alternative.
As I&amp;rsquo;m the maintainer of the &lt;a href="https://dmp.fabric8.io/" target="_blank" rel="noreferrer"&gt;fabric8io/docker-maven-plugin&lt;/a&gt;, I&amp;rsquo;d like to comment on this matter.&lt;/p&gt;
&lt;p&gt;I already commented on the original blog post (thanks for approving the comment), but I&amp;rsquo;m happy to repeat my arguments
here again.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://codefresh.io/howtos/using-docker-maven-maven-docker/" target="_blank" rel="noreferrer"&gt;article&lt;/a&gt; ditches two docker-maven-plugins before it promotes Docker multi-stage builds for some reasons.&lt;/p&gt;
&lt;p&gt;To be honest, I think both approaches have their benefits, but let me comment first on two arguments given concerning the &lt;a href="https://github.com/fabric8io/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;fabric8io/docker-maven-plugin&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;There have been cases in the past where Docker has broken compatibility even between its client and server, so a Maven plugin that uses the same API will instantly break as well.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;This compatibility issue might be right especially if you use a typed approach to access the Docker REST API which is used by various Docker client libraries. As explained in the post, fabric8 d-m-p accesses the Docker daemon directly without any client library and with not marshalling. This is because it accesses only the parts required for the plugin&amp;rsquo;s feature set, which also means that json responses are handled in a very defensive and untyped way.&lt;/p&gt;
&lt;p&gt;And yes, there was one issue in the early days in 2014 with a backwards-incompatible API change from Docker. This issue could be fixed quite quickly because d-m-p hadn&amp;rsquo;t to wait for a client library to be updated. However, since then there never has been an issue and for the core functionality that d-m-p uses.&lt;/p&gt;
&lt;p&gt;I think the relevance of Docker API incompatibilities is exaggerated in this blog post.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Hopefully, the fabric8 plugin also supports plain Dockerfiles. Even there, however, it has some strong opinions. It assumes that the Dockerfile of a project is in src/main/docker and also it uses the assembly syntax for actually deciding what artefact is available during the Docker build step.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;That is simply not true. You can just put a Dockerfile on the same level as the pom.xml, refer to your artefacts in the &lt;code&gt;target/&lt;/code&gt; directory (with Maven property substitution), and then declare the plugin &lt;em&gt;without any configuration&lt;/em&gt;.
See my &lt;a href="https://ro14nd.de/simple-dockerfile-mode-dmp" target="_blank" rel="noreferrer"&gt;other blog post&lt;/a&gt; for a short description of how it works.&lt;/p&gt;
&lt;p&gt;BTW, the reason for the own XML syntax is a historical one. The plugin started in 2014 when Dockerfile was entirely unknown to Java developers. But Maven plugin XML configuration was (and still is) a well-known business. As time passed by and Docker become more and more popular for Java developers, the &lt;code&gt;Dockerfile&lt;/code&gt; syntax is well known now these days, too. So, I completely agree, that you should use Dockerfiles if possible, and that&amp;rsquo;s why the plugin supports Dockerfiles as a first-class citizen since the recent versions. The next step is to add similar support for &lt;code&gt;docker-compose.yml&lt;/code&gt; files for running containers. There is already docker compose support included, albeit a bit hidden.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;I agree that multi-stage Docker builds are fantastic for generating reproducible builds, as the build tool (Maven) is used in a well-defined version. However, using a locally installed Maven during development has advantages, too. E.g. the local Maven repository avoids downloading artefacts over and over again, resulting in much faster build times and turnaround times. Of course, you can add caching to the mix for multi-stage builds, but then the setup gets more and more involved. Compare this to using a d-m-p for which you don&amp;rsquo;t even need a local Docker CLI installed, and you can &amp;lsquo;just start&amp;rsquo;. For CI builds this properly doesn&amp;rsquo;t matter much though (and that&amp;rsquo;s what the blog post is all about I guess).&lt;/p&gt;
&lt;p&gt;Other advantages of using fabric8&amp;rsquo;s d-m-p :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Running all your containers (app + deps) locally without the need of support from a CI system. As a side note, the custom compose-like syntax of codefresh&amp;rsquo;s CI is not so much different to the custom configuration syntax of fabric8&amp;rsquo;s d-m-p. It&amp;rsquo;s custom.&lt;/li&gt;
&lt;li&gt;Extended authentication support against various registries (Amazon ECR, Google GCR, &amp;hellip;)&lt;/li&gt;
&lt;li&gt;Automatic rebuilds during development with &lt;code&gt;docker:watch&lt;/code&gt; which increase turnaround times tremendously&lt;/li&gt;
&lt;li&gt;Download support files (e.g. startup scripts) automatically by just declaring a dependency in the plugin (blog post pending)&lt;/li&gt;
&lt;li&gt;&amp;hellip;. and even more stuff.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the end, your mileage may vary, but having an article conclusion without really trying to compare pros and cons of both approaches is far too biased for me.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update: Kostis replied to my comment, and an interesting discussion is going over &lt;a href="https://codefresh.io/howtos/using-docker-maven-maven-docker/#comment-159" target="_blank" rel="noreferrer"&gt;there&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>When a Dockerfile is just good enough</title><link>https://ro14nd.de/simple-dockerfile-mode-dmp/</link><pubDate>Thu, 12 Apr 2018 00:00:00 +0000</pubDate><guid>https://ro14nd.de/simple-dockerfile-mode-dmp/</guid><description>&lt;p&gt;As you might know, one of my Open Source babies is the one and only &lt;a href="https://github.com/fabric8io/docker-maven-plugin/" target="_blank" rel="noreferrer"&gt;fabric8io/docker-maven-plugin&lt;/a&gt; (d-m-p).
If you already use this Maven plugin, you know, that it is super powerful and flexible to configure.
This flexibility comes at a price so that the configuration can become quite complicated.
Now, if you only want to &lt;em&gt;build&lt;/em&gt; Docker images with Maven, I have good news:
Since 0.25.1 d-m-p supports a zero XML configuration mode, the so-called &lt;a href="https://dmp.fabric8.io/#simple-dockerfile-build" target="_blank" rel="noreferrer"&gt;Simple Dockerfile Build&lt;/a&gt; mode.&lt;/p&gt;
&lt;p&gt;The idea of this mode started with a Twitter discussion:&lt;/p&gt;
&lt;img src="https://ro14nd.de/images/simple-dockerfile-mode-dmp/maven-dmp-tweet.png" class="shadow center"/&gt;
&lt;p&gt;And actually, it&amp;rsquo;s true: If all that you want is to build a single Docker image from a Dockerfile, then the initial configuration is indeed too complex.&lt;/p&gt;
&lt;p&gt;d-m-p already supports &lt;a href="https://dmp.fabric8.io/#external-dockerfile" target="_blank" rel="noreferrer"&gt;plain Dockerfiles&lt;/a&gt; for quite some time, and that even for multiple images.
However, you still have to reference those Dockerfiles in the XML configuration of the plugin.&lt;/p&gt;
&lt;p&gt;Since 0.25.1 you can now use the so-called &lt;a href="https://dmp.fabric8.io/#simple-dockerfile-build" target="_blank" rel="noreferrer"&gt;Simple Dockerfile Build&lt;/a&gt; mode (kudos go to Rohan Kumar for the initial &lt;a href="https://github.com/fabric8io/docker-maven-plugin/pull/969" target="_blank" rel="noreferrer"&gt;implementation&lt;/a&gt;).
All you have to do is to add d-m-p to your &lt;code&gt;pom.xml&lt;/code&gt; and add a Dockerfile.
The smallest possible Maven project for creating a Docker image consists of this &lt;code&gt;pom.xml&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;project&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;modelVersion&amp;gt;&lt;/span&gt;4.0.0&lt;span style="color:#f92672"&gt;&amp;lt;/modelVersion&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;fabric8&lt;span style="color:#f92672"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;smallest&lt;span style="color:#f92672"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1-SNAPSHOT&lt;span style="color:#f92672"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;build&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;plugins&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;io.fabric8&lt;span style="color:#f92672"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;docker-maven-plugin&lt;span style="color:#f92672"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;0.26.0&lt;span style="color:#f92672"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;/plugins&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;/build&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/project&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and a &lt;code&gt;Dockerfile&lt;/code&gt; alongside this pom:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-dockerfile" data-lang="dockerfile"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; &lt;span style="color:#e6db74"&gt;busybox&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;CMD&lt;/span&gt; [&lt;span style="color:#e6db74"&gt;&amp;#34;echo&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;Hello&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;world!&amp;#34;&lt;/span&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This image does not really much.
With &lt;code&gt;mvn docker:build&lt;/code&gt; you can build it, with &lt;code&gt;docker run fabric8/smallest&lt;/code&gt; you can test it.
Or use &lt;code&gt;mvn docker:run&lt;/code&gt; so that you even don&amp;rsquo;t have to provide the image name.&lt;/p&gt;
&lt;p&gt;A more realistic Dockerfile could look like&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-dockerfile" data-lang="dockerfile"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; &lt;span style="color:#e6db74"&gt;openjdk:jre&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;ARG&lt;/span&gt; jar&lt;span style="color:#f92672"&gt;=&lt;/span&gt;target/app-1.0.0-SNAPSHOT.jar&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;ADD&lt;/span&gt; $jar /app.jar&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;CMD&lt;/span&gt; java -cp /app.jar HelloWorld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;where we define &lt;code&gt;jar&lt;/code&gt; as &lt;a href="https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg" target="_blank" rel="noreferrer"&gt;build arg&lt;/a&gt; in the Dockerfile but also as property in the &lt;code&gt;pom.xml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;properties&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;jar&amp;gt;&lt;/span&gt;${project.build.directory}/${project.build.finalName}.jar&lt;span style="color:#f92672"&gt;&amp;lt;/jar&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/properties&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;You can use Maven properties in the Dockerfile which get automatically replaced by &lt;code&gt;docker:build&lt;/code&gt; when creating the image.
But you can use that Dockerfile also without Maven with &lt;code&gt;docker build .&lt;/code&gt;
You can&amp;rsquo;t use Maven properties with &lt;code&gt;.&lt;/code&gt; directly as dots are not allowed in Docker build args, therefore we use an extra property.
However, a maven-less usage probably does not make much sense when you don&amp;rsquo;t also build the artefacts.
The full example can be found in the &lt;a href="https://github.com/fabric8io/docker-maven-plugin/tree/master/samples/zero-config" target="_blank" rel="noreferrer"&gt;dmp GitHub repo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you can forgo Docker build args you can use predefined Maven properties directly:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-dockerfile" data-lang="dockerfile"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; &lt;span style="color:#e6db74"&gt;openjdk:jre&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;ADD&lt;/span&gt; &lt;span style="color:#e6db74"&gt;${&lt;/span&gt;project.build.directory&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;/&lt;span style="color:#e6db74"&gt;${&lt;/span&gt;project.build.finalName&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;.jar /app.jar&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;CMD&lt;/span&gt; java -cp /app.jar HelloWorld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The image name is auto-generated, but you can set this name also by yourself by setting the property &lt;code&gt;docker.name&lt;/code&gt; (and you can use &lt;a href="https://dmp.fabric8.io/#image-name-placeholders" target="_blank" rel="noreferrer"&gt;placeholders&lt;/a&gt; within this name)&lt;/p&gt;
&lt;p&gt;You can even start the container with &lt;code&gt;mvn docker:run&lt;/code&gt; although without any additional configuration (e.g. like port mappings).
Also, you can &lt;code&gt;docker:push&lt;/code&gt; the image.&lt;/p&gt;
&lt;p&gt;You can still configure certain aspects like authentication or bind d-m-p goals to default lifecycle phases.
Using this mode is very similar to the functionality offered by &lt;a href="https://github.com/spotify/dockerfile-maven" target="_blank" rel="noreferrer"&gt;spotify/dockerfile-maven&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you need more horsepower, you can gradually expand on this simple setup.
Features which are waiting to be discovered are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Setup of multiple images for running integration tests&lt;/li&gt;
&lt;li&gt;Custom networks and volumes for your tests&lt;/li&gt;
&lt;li&gt;Using docker-compose files for running the containers directly from the plugin&lt;/li&gt;
&lt;li&gt;Exporting the Docker image as an archive&lt;/li&gt;
&lt;li&gt;Watch docker containers and restart them when the code changes&lt;/li&gt;
&lt;li&gt;All can be configured via properties, too and since with the latest versions, you can mix it with XML configuration.&lt;/li&gt;
&lt;li&gt;&amp;hellip;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you are interested in more to find out, then please have a look at the &lt;a href="https://dmp.fabric8.io/" target="_blank" rel="noreferrer"&gt;reference manual&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m curious what you think about this new mode.
Please use the comments below if you want to leave some feedback.
In fact, there are concrete plans for d-m-p to include the &lt;a href="https://maven.fabric8.io/#generators" target="_blank" rel="noreferrer"&gt;generators&lt;/a&gt; from the fabric8-maven-plugin functionality of autodetecting the tech stacks used for creating opinionated Docker images.&lt;/p&gt;</description></item><item><title>docker-maven-plugin moves on</title><link>https://ro14nd.de/dmp-moves-on/</link><pubDate>Wed, 24 Feb 2016 00:00:00 +0000</pubDate><guid>https://ro14nd.de/dmp-moves-on/</guid><description>&lt;p&gt;&lt;strong&gt;rhuss/docker-maven-plugin&lt;/strong&gt; is dead, long live &lt;strong&gt;fabric8io/docker-maven-plugin&lt;/strong&gt; !&lt;/p&gt;
&lt;p&gt;If you follow the Docker Maven Plugin Scene&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;, you probably noticed that there has been quite some progress in the last year. Started as a personal research experiment early 2014, &lt;a href="https://github.com/fabric8io/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;rhuss/docker-maven-plugin&lt;/a&gt; (d-m-p) has took off a little bit. With more than 300 GitHub stars it&amp;rsquo;s now the second most popular docker-maven-plugin. With 38 contributors we were able to do 36 releases. It is really fantastic to see that many people contributing to a rather niche product. Many kudos go out to &lt;a href="https://github.com/jgangemi" target="_blank" rel="noreferrer"&gt;Jae&lt;/a&gt; for his many contributions and continued support on fixing and answering issues. Thanks also for always being very patient with my sometimes quite opinionated and picky code reviews :)&lt;/p&gt;
&lt;p&gt;However it is now time to ignite the next stage and bring this personal &amp;lsquo;pet&amp;rsquo; project to a wider context. And what is better suited here than the fabric8 community ?&lt;/p&gt;
&lt;p&gt;&lt;a href="http://fabric8.io" target="_blank" rel="noreferrer"&gt;Fabric8&lt;/a&gt; is a next generation DevOps and integration platform for Docker based applications, with a focus on &lt;a href="http://kubernetes.io/" target="_blank" rel="noreferrer"&gt;Kubernetes&lt;/a&gt; and &lt;a href="https://www.openshift.com/" target="_blank" rel="noreferrer"&gt;OpenShift&lt;/a&gt; as orchestration and build infrastructure. Its a collection of multiple interrelated projects including Maven tooling for interacting with Kubernetes and OpenShift. d-m-p is already included as foundation for creating Docker application images.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m very happy that d-m-p has now found its place in this ecosystem where it will continue to flourish even faster.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://fabric8.io/community/index.html" target="_blank" rel="noreferrer"&gt;fabric8 community&lt;/a&gt; is very open and has established multiple communications channels on which you will find d-m-p now, too:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#fabric8&lt;/code&gt; on &lt;code&gt;irc.freenode.net&lt;/code&gt; is an IRC channel with a lot of helpful hands (including myself)&lt;/li&gt;
&lt;li&gt;A &lt;a href="https://groups.google.com/forum/#!forum/fabric8" target="_blank" rel="noreferrer"&gt;mailing list&lt;/a&gt; for more in depth discussions&lt;/li&gt;
&lt;li&gt;Issues are still tracked with &lt;a href="https://github.com/fabric8io/docker-maven-plugin/issues" target="_blank" rel="noreferrer"&gt;GitHub issues&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;d-m-p specific blog posts will go out on the &lt;a href="https://blog.fabric8.io/" target="_blank" rel="noreferrer"&gt;fabric8 blog&lt;/a&gt; in the future.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, what changed ?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;rhuss/docker-maven-plugin&lt;/code&gt; has been transferred to &lt;a href="https://github.com/fabric8io/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;fabric8io/docker-maven-plugin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The Maven group id has changed from &lt;code&gt;org.jolokia&lt;/code&gt; to &lt;code&gt;io.fabric8&lt;/code&gt; for all releases 0.14.0 and later.&lt;/li&gt;
&lt;li&gt;CI and release management will be done on the fabric8 platform.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And what will &lt;strong&gt;not&lt;/strong&gt; change ?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;d-m-p will always be usable with plain Docker, speaking either to a remote or local Docker daemon. No Kubernetes, no OpenShift required.&lt;/li&gt;
&lt;li&gt;I&amp;rsquo;ll continue to work on d-m-p ;-)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks so much for all the fruitful feedback and pull requests. Keep on rocking ;-)&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;with more than 15 &lt;code&gt;docker-maven-plugin&lt;/code&gt;s its probably fair to call it a &amp;ldquo;scene&amp;rdquo; ;-)&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>Registry Magic with docker-maven-plugin</title><link>https://ro14nd.de/registry-magic-with-dmp/</link><pubDate>Thu, 21 Jan 2016 00:00:00 +0000</pubDate><guid>https://ro14nd.de/registry-magic-with-dmp/</guid><description>&lt;p&gt;Dealing with multiple Docker registries is hard, mostly because the meta information where a image is located is part of a Docker image&amp;rsquo;s name, which is typically used as an identifier, too.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see how the &lt;a href="https://github.com/rhuss/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;rhuss/docker-maven-plugin&lt;/a&gt; deals with this peculiarity.&lt;/p&gt;
&lt;p&gt;When setting up a Maven build for creating Docker images out of your Java application, the classical way to specify the registry where to push the final Docker image is to bake it into the image&amp;rsquo;s name. The drawback however is that you couple your build to this particular registry so that it is not possible to push your image to another registry when building the image.&lt;/p&gt;

&lt;h3 class="relative group"&gt;Pull and Push
 &lt;div id="pull-and-push" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#pull-and-push" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;The &lt;a href="https://github.com/rhuss/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;docker-maven-plugin&lt;/a&gt; (&lt;code&gt;d-m-p&lt;/code&gt; in short) interacts&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt; with Docker registries in two use cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pulling&lt;/strong&gt; base images from a registry when building images with &lt;code&gt;docker:build&lt;/code&gt; or starting images with &lt;code&gt;docker:start&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pushing&lt;/strong&gt; built images to a registry with &lt;code&gt;docker:push&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In both cases you can define your build agnostic from any registry by omitting the registry part in your image names&lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt; and specify it externally as meta information. This can be done in various ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Adding it to the plugin configuration as an &lt;code&gt;&amp;lt;registry&amp;gt;&lt;/code&gt; element. This can be easily put into a Maven profile (either directly in the &lt;code&gt;pom.xml&lt;/code&gt; or also in &lt;code&gt;~/.m2/settings.xml&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Using a system property &lt;code&gt;docker.registry&lt;/code&gt; when running Maven&lt;/li&gt;
&lt;li&gt;As a final fallback an environment variable &lt;code&gt;DOCKER_REGISTRY&lt;/code&gt; can be used, too.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mvn -Ddocker.registry=myregistry.domain.com:5000 docker:push
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you combine build and push steps in a single call like in&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mvn package docker:build docker:push
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;a pull operation for a base image and a push operation can happen. To allow different registries in this situation the properties &lt;code&gt;docker.pull.registry&lt;/code&gt; and &lt;code&gt;docker.push.registry&lt;/code&gt; are supported, too, (with the corresponding configuration elements &lt;code&gt;&amp;lt;pullRegistry&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;pushRegistry&amp;gt;&lt;/code&gt;, respectively).&lt;/p&gt;
&lt;p&gt;When pushing an image this way, the following happens behind the scene (assuming an image named &lt;code&gt;user/myimage&lt;/code&gt; and target registry &lt;code&gt;myregistry:5000&lt;/code&gt;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The image &lt;code&gt;user/myimage&lt;/code&gt; is tagged temporarily as &lt;code&gt;myregistry:5000/user/myimage&lt;/code&gt; in the Docker daemon.&lt;/li&gt;
&lt;li&gt;The image &lt;code&gt;myregistry:5000/user/myimage&lt;/code&gt; is pushed.&lt;/li&gt;
&lt;li&gt;The tag is removed again.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 class="relative group"&gt;Authentication
 &lt;div id="authentication" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#authentication" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;That&amp;rsquo;s all fine, but how does d-m-p deal with authentication ? Again, there are several possibilities how authentication can be performed against a registry:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Using a &lt;code&gt;&amp;lt;authConfig&amp;gt;&lt;/code&gt; section in the plugin configuration with&lt;code&gt;&amp;lt;username&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;password&amp;gt;&lt;/code&gt; elements.&lt;/li&gt;
&lt;li&gt;Providing system properties &lt;code&gt;docker.username&lt;/code&gt; and &lt;code&gt;docker.password&lt;/code&gt; when running Maven&lt;/li&gt;
&lt;li&gt;Using a &lt;code&gt;&amp;lt;server&amp;gt;&lt;/code&gt; configuration in &lt;code&gt;~/.m2/settings.xml&lt;/code&gt; with possible encrypted password. That&amp;rsquo;s the most maven-ish way for doing authentication.&lt;/li&gt;
&lt;li&gt;Login into the registry with &lt;code&gt;docker login&lt;/code&gt;. The plugin will pick up the credentials from &lt;code&gt;~/.docker/config.json&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are again variants to distinguish between authentication for pulling and pushing images to registries (e.g. &lt;code&gt;docker.push.username&lt;/code&gt; and &lt;code&gt;docker.push.password&lt;/code&gt;). All the details can be found in the &lt;a href="http://ro14nd.de/docker-maven-plugin/authentication.html" target="_blank" rel="noreferrer"&gt;reference manual&lt;/a&gt;.&lt;/p&gt;

&lt;h3 class="relative group"&gt;Using the OpenShift Registry
 &lt;div id="using-the-openshift-registry" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#using-the-openshift-registry" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://www.openshift.com/" target="_blank" rel="noreferrer"&gt;OpenShift&lt;/a&gt; is an awesome PaaS platform on top of &lt;a href="http://kubernetes.io/" target="_blank" rel="noreferrer"&gt;Kubernetes&lt;/a&gt;. It comes with an &lt;a href="https://docs.openshift.com/enterprise/latest/install_config/install/docker_registry.html" target="_blank" rel="noreferrer"&gt;own Docker registry&lt;/a&gt; which can be used by d-m-p, too. However, there are some things to watch out for.&lt;/p&gt;
&lt;p&gt;First of all, the registry needs to be exposed to the outside so that a Docker daemon outside the OpenShift cluster can talk with the registry:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;oc expose service/docker-registry --hostname=docker-registry.mydomain.com
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The hostname provided should be resolved by your host to the OpenShift API server&amp;rsquo;s IP (this happens automatically if you use the &lt;a href="http://fabric8.io/guide/getStarted/vagrant.html" target="_blank" rel="noreferrer"&gt;fabric8 OpenShift Vagrant image&lt;/a&gt; for a one-node developer installation of OpenShift).&lt;/p&gt;
&lt;p&gt;Next, it is important to know, that the OpenShift registry use the regular OpenShift SSO authentication, so you have to login into OpenShift before you can push to the registry. The access token obtained from the login is then used as the password for accessing the registry:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Login to OpenShift. Credentials are stored in ~/.kube/config.json:
oc login

# Use user and access token for authentication:
mvn docker:push -Ddocker.registry=docker-registry.mydomain.com \
 -Ddocker.username=$(oc whoami) \
 -Ddocker.password=$(oc whoami -t)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The last step can be simplified by using &lt;code&gt;-Ddocker.useOpenShiftAuth&lt;/code&gt; which does the user and token lookup transparently.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mvn docker:push -Ddocker.registry=docker-registry.mydomain.com \
 -Ddocker.useOpenShiftAuth
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The configuration option &lt;code&gt;useOpenShiftAuth&lt;/code&gt; again comes in multiple flavours: a default one, and dedicated for push and pull operations (&lt;code&gt;docker.pull.useOpenShiftAuth&lt;/code&gt; and &lt;code&gt;docker.push.useOpenShiftAuth&lt;/code&gt;).&lt;/p&gt;

&lt;h3 class="relative group"&gt;tl;dr
 &lt;div id="tldr" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#tldr" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;Among all the &lt;a href="https://github.com/search?utf8=%E2%9C%93&amp;amp;q=docker-maven-plugin" target="_blank" rel="noreferrer"&gt;many docker maven plugins&lt;/a&gt;, &lt;a href="https://github.com/rhuss/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;rhuss/docker-maven-plugin&lt;/a&gt; provides the most flexible options for accessing Docker registries and authentication. The gory details can be found in the &lt;a href="http://ro14nd.de/docker-maven-plugin/" target="_blank" rel="noreferrer"&gt;reference manual&lt;/a&gt; which documents &lt;a href="http://ro14nd.de/docker-maven-plugin/" target="_blank" rel="noreferrer"&gt;registry handling&lt;/a&gt; and &lt;a href="http://ro14nd.de/docker-maven-plugin/authentication.html" target="_blank" rel="noreferrer"&gt;authentication&lt;/a&gt; in detail.&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;The interaction is always indirectly via the Docker daemon, since a Docker client like d-m-p only talks with the Docker daemon directly.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;Of course you can the registry part in your image names in which case this registry has always the highest priority.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>docker:watch</title><link>https://ro14nd.de/maven-docker-watch/</link><pubDate>Tue, 30 Jun 2015 00:00:00 +0000</pubDate><guid>https://ro14nd.de/maven-docker-watch/</guid><description>&lt;p&gt;Ok, you know Docker. And since you are a Java developer you want to know how you can use this in your daily development workflow. You probably also heard about &lt;em&gt;the&lt;/em&gt; &lt;a href="https://github.com/rhuss/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;docker-maven-plugin&lt;/a&gt; which seamlessly creates Docker images, starts and stops Docker containers and more all with a concise configuration syntax.&lt;/p&gt;
&lt;p&gt;And now there is this new goal &lt;code&gt;docker:watch&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;We developers are lazy, right ? We want our code to compile fast, we want the servers to start up fast. And we want to test changes quickly. That&amp;rsquo;s why we love &lt;a href="http://www.osgi.org/Main/HomePage" target="_blank" rel="noreferrer"&gt;OSGi&lt;/a&gt;&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt; and &lt;a href="http://zeroturnaround.com/software/jrebel/" target="_blank" rel="noreferrer"&gt;JRebel&lt;/a&gt;. And we want this for Docker containers, too.&lt;/p&gt;
&lt;p&gt;Good news. &lt;a href="https://github.com/rhuss/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;docker-maven-plugin&lt;/a&gt; will support hot rebuild of Docker images and hot restart of containers with a new Maven goal &lt;code&gt;docker:watch&lt;/code&gt;. It will be released with version 0.12.1. For the brave coder 0.12.1-SNAPSHOT is already out there, the documentation can be found &lt;a href="https://github.com/rhuss/docker-maven-plugin/blob/integration/doc/manual.md#dockerwatch" target="_blank" rel="noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But before losing more words, here&amp;rsquo;s a sneak preview.&lt;/p&gt;
&lt;iframe src="https://player.vimeo.com/video/132183699" width="720" height="405" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;That&amp;rsquo;s of course not entirely true. We love OSGi &amp;hellip; or we hate it with passion. But even the haters don&amp;rsquo;t hate it for its hot deployment abilities.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>Real clean Maven builds with Docker</title><link>https://ro14nd.de/clean-maven-builds-with-docker/</link><pubDate>Fri, 07 Nov 2014 00:00:00 +0000</pubDate><guid>https://ro14nd.de/clean-maven-builds-with-docker/</guid><description>&lt;p&gt;A local Maven repository serves as a cache for artifacts and dependencies, we all know this. This helps in speeding up things but can cause subtle problems when doing releases. Docker can help here a bit for avoiding caching issues.&lt;/p&gt;
&lt;p&gt;Before doing a release I typically move &lt;code&gt;~/.m2/repository&lt;/code&gt; away to be really sure that everybody else can build the source as well and that any dependencies are also on the remote Maven repository. This is a bit tedious, because it is a manual process and you can forget to move the old directory back which will was a LOT of disk space over time.&lt;/p&gt;
&lt;p&gt;Docker can help here a bit: Since yesterday there is an &lt;a href="https://registry.hub.docker.com/_/maven/" target="_blank" rel="noreferrer"&gt;official Maven image&lt;/a&gt; which can be used to build your project. The nice thing for doing releases with this image is, that it always starts afresh with an empty local Maven repository.&lt;/p&gt;
&lt;p&gt;Assuming you are currently located in the top-level directory holding your &lt;code&gt;pom.xml&lt;/code&gt; you can use this single command for running a real clean build:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;docker run -it --rm \ 
	 -v &amp;quot;$(pwd)&amp;quot;:/usr/src/mymaven \ 
	 -w /usr/src/mymaven \ 
	 maven:3.2-jdk-7 \
	 mvn clean install
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this call you mount your project directory into &lt;code&gt;/usr/src/mymaven&lt;/code&gt; on the container, change to this directory in the container and call &lt;code&gt;mvn clean install&lt;/code&gt;. At the end, your container will be removed (&lt;code&gt;--rm&lt;/code&gt;) so there is no chance that you might forget to clean up afterwards.&lt;/p&gt;
&lt;p&gt;Of course it will download all the artifacts each time, so it is not a good idea to use this approach for your daily developer business (especially if you using Maven central as remote Maven repository).&lt;/p&gt;
&lt;p&gt;You can also play around with various versions of Maven by changing the image tag so at the end you can be really sure, that your project will build everywhere. Please refer to the &lt;a href="https://registry.hub.docker.com/_/maven/" target="_blank" rel="noreferrer"&gt;Docker Hub page&lt;/a&gt; for details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: As pointed out by &lt;a href="https://twitter.com/noahlz/status/530708791906807808" target="_blank" rel="noreferrer"&gt;Noah Zucker&lt;/a&gt; on Twitter you can redirect of course the local repository via &lt;code&gt;-Dmaven.repo.local=/tmp/clean-repo&lt;/code&gt; temporarily to a new location. Which is confessedly much simpler and I would prefer that one instead if you don&amp;rsquo;t need to check with different JDKs or Maven versions. Sometimes you don&amp;rsquo;t see the forest for the trees if you come from the wrong direction (e.g. looking for use case of a specific docker image).&lt;/p&gt;</description></item><item><title>Docker maven plugin rewrite</title><link>https://ro14nd.de/docker-maven-plugin-rewrite/</link><pubDate>Mon, 13 Oct 2014 00:00:00 +0000</pubDate><guid>https://ro14nd.de/docker-maven-plugin-rewrite/</guid><description>&lt;p&gt;My &lt;a href="https://github.com/rhuss/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;docker-maven-plugin&lt;/a&gt; is undergoing a major refactoring. This post explains the motivation behind this and also what you can expect in the very near future.
The configuration syntax becomes much cleaner and implicit behavior was removed.&lt;/p&gt;
&lt;p&gt;Originally, I needed a &lt;em&gt;docker-maven-plugin&lt;/em&gt; for a very specific use case: To test &lt;a href="http://www.jolokia.org" target="_blank" rel="noreferrer"&gt;Jolokia&lt;/a&gt;, the HTTP-JMX bridge in all the JEE and non-JEE servers out there. This was a very manual process: Fire up the VirtualBox image with all those servers installed, start a server, deploy Jolokia, run integration tests, stop the server, start the next server &amp;hellip;. It takes easily half a day or more to do the tests before each release. That&amp;rsquo;s not the kind of QA you are looking for, really. But with docker there is finally the opportunity to automate all this: Deploy a single application on multiple different servers while controlling the lifecycle of theses servers from within the build.&lt;/p&gt;
&lt;p&gt;Early this year when I searched the Web, I couldn&amp;rsquo;t find a good Docker build integration, so I decided to write my own &lt;a href="http://github.com/rhuss/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;docker-maven-plugin&lt;/a&gt; to back my use case. Today you find nearly a dozen of Maven plugins for your Docker business. However, only four plugins (&lt;a href="https://github.com/alexec/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;alexec&lt;/a&gt;, &lt;a href="https://github.com/wouterd/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;wouterd&lt;/a&gt;, &lt;a href="https://github.com/spotify/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;spotify&lt;/a&gt; and &lt;a href="https://github.com/rhuss/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;rhuss&lt;/a&gt;) are still actively maintained. A later blog post will present a detailed comparison between those four plugins (or come to my &lt;a href="http://jax.de/wjax2014/sessions/docker-fuer-java-entwickler" target="_blank" rel="noreferrer"&gt;W-JAX&lt;/a&gt; session), but this post is about the evolution of the &lt;code&gt;rhuss&lt;/code&gt; plugin.&lt;/p&gt;
&lt;p&gt;It turned out that the plugin works quite well, people liked and starred it on GitHub. It provides also some unique features like creating Docker images from &lt;a href="http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html" target="_blank" rel="noreferrer"&gt;assembly descriptors&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But I was not so happy.&lt;/p&gt;
&lt;p&gt;The reason is, that I started from a very special, probably very uncommon use case: A single application, multiple different servers for multiples tests. A much more common scenario is to have a fixed application server brand for the application, running with multiple linked backend containers like databases. My plugin doesn&amp;rsquo;t work well with running multiple containers at once. Or to state it otherwise: The plugin was not prepared for orchestration of multiple docker containers.&lt;/p&gt;
&lt;p&gt;Also, there was too much happening &lt;em&gt;magically&lt;/em&gt; behind the scenes: When pushing a data image, it was implicitly build. When starting a container for integration test, the data container is also build before.&lt;/p&gt;
&lt;p&gt;Two operational modes were supported: One with images holding the server and data separately in two containers (linked via &lt;code&gt;volumes&lt;/code&gt;) and one so called &lt;em&gt;merged&lt;/em&gt; image, holding both, the application and server together in one image. This is perfect for creating micro services. The mode is determined only by a configuration flag (&lt;code&gt;mergeData&lt;/code&gt;), but it is not really clear how many and what Docker images are created. And it was hard to document which is always a very bad smell.&lt;/p&gt;
&lt;p&gt;So I changed the configuration syntax completely.&lt;/p&gt;
&lt;p&gt;It is now much more explicit and you will know merely by looking at the configuration which and how many containers will be started during integration testing and what the container with the application will look like. I don&amp;rsquo;t want to go into much detail here, the post is already too long. Instead here is an example of the new syntax:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;plugin&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;groupId&amp;gt;org.jolokia&amp;lt;/groupId&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;artifactId&amp;gt;docker-maven-plugin&amp;lt;/artifactId&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;version&amp;gt;0.10.1&amp;lt;/version&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;configuration&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;images&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;image&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;name&amp;gt;consol/tomcat-7.0&amp;lt;/name&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;run&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;volumes&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;from&amp;gt;jolokia/docker-jolokia-demo&amp;lt;/from&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/volumes&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;ports&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;port&amp;gt;jolokia.port:8080&amp;lt;/port&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/ports&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;wait&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;url&amp;gt;http://localhost:${jolokia.port}/jolokia&amp;lt;/url&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;time&amp;gt;10000&amp;lt;/time&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/wait&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/run&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/image&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;image&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;name&amp;gt;jolokia/docker-jolokia-demo&amp;lt;/name&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;build&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;assemblyDescriptor&amp;gt;src/main/assembly.xml&amp;lt;/assemblyDescriptor&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/build&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/image&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/images&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/configuration&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This examples creates and starts &lt;strong&gt;two&lt;/strong&gt; containers during &lt;code&gt;docker:start&lt;/code&gt;, linked together via the &lt;code&gt;volumes&lt;/code&gt; directive. The &lt;strong&gt;&lt;code&gt;&amp;lt;run&amp;gt;&lt;/code&gt;&lt;/strong&gt; configuration section is used to describe the runtime behavior for &lt;code&gt;docker:start&lt;/code&gt; and &lt;code&gt;docker:stop&lt;/code&gt;, and &lt;strong&gt;&lt;code&gt;&amp;lt;build&amp;gt;&lt;/code&gt;&lt;/strong&gt; is for specifying how images are build up during &lt;code&gt;docker:build&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Alternatively, a &lt;strong&gt;single&lt;/strong&gt; image could be created:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;plugin&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;groupId&amp;gt;org.jolokia&amp;lt;/groupId&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;artifactId&amp;gt;docker-maven-plugin&amp;lt;/artifactId&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;version&amp;gt;0.10.1&amp;lt;/version&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;configuration&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;images&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;image&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;name&amp;gt;jolokia/docker-jolokia-combined-demo&amp;lt;/name&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;build&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;baseImage&amp;gt;consol/tomcat-7.0&amp;lt;/baseImage&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;assemblyDescriptor&amp;gt;src/main/assembly.xml&amp;lt;/assemblyDescriptor&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/build&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;run&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;ports&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;port&amp;gt;jolokia.port:8080&amp;lt;/port&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/ports&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;wait&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;url&amp;gt;http://localhost:${jolokia.port}/jolokia&amp;lt;/url&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/wait&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/run&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/image&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/images&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/configuration&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Here &lt;code&gt;consol/tomcat-7.0&lt;/code&gt; is used as base for the image to build and the data referenced in the assembly descriptor is copied into the image. So there is no need to volume-link them together.&lt;/p&gt;
&lt;p&gt;I won&amp;rsquo;t repeat the old, more confusing syntax for this both use cases here, you find it in the current &lt;a href="http://github.com/rhuss/docker-maven-plugin" target="_blank" rel="noreferrer"&gt;online documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Said all that, and since &lt;code&gt;rhuss/docker-maven-plugin&lt;/code&gt; is still pre-1.0, I take the liberty to change it without much thoughts on backwards compatibility (you can easily update old configurations). The new syntax is available since &lt;code&gt;0.10.1&lt;/code&gt;, the old syntax will still be used in the &lt;code&gt;0.9.x&lt;/code&gt; line. Everybody is encouraged to upgrade to &lt;code&gt;0.10.x&lt;/code&gt;, although the documentation still reflects the old syntax (will be fixed soon). Please refer to the &lt;a href="https://github.com/rhuss/docker-maven-plugin/tree/new-config/samples" target="_blank" rel="noreferrer"&gt;examples&lt;/a&gt; on the &lt;code&gt;new-config&lt;/code&gt; branch for more details. An upgrade path will be available soon, too.&lt;/p&gt;
&lt;p&gt;There will be a &lt;code&gt;1.0.0&lt;/code&gt; release before the end of this year.&lt;/p&gt;
&lt;p&gt;Please let me know your feedback on the new syntax and what features you would like to see. Everything is moving before the 1.0.0 freeze. You can open an &lt;a href="http://github.com/rhuss/docker-maven-plugin/issues" target="_blank" rel="noreferrer"&gt;issue&lt;/a&gt; for any suggestion or feature request.&lt;/p&gt;</description></item></channel></rss>