Git Product home page Git Product logo

docker-maven-plugin's Introduction

docker-maven-plugin

Build Status Maven Central License

A Maven plugin for building and pushing Docker images.

Status: inactive

We recommend you use dockerfile-maven instead.

The future of docker-maven-plugin

This plugin was the initial Maven plugin used at Spotify for building Docker images out of Java services. It was initially created in 2014 when we first began experimenting with Docker. This plugin is capable of generating a Dockerfile for you based on configuration in the pom.xml file for things like the FROM image, resources to add with ADD/COPY, etc.

Over time at Spotify we have realized that the simplest way to build a Docker image from a Java project is to have the developer write the Dockerfile. The behavior of this plugin around generating Dockerfiles, copying your project directory to a "staging" directory to use as the Docker build context, etc., ultimately led to a lot of unnecessary confusion with our users that stemmed from introducing extra abstractions and a need for configuration on top of what Docker is providing.

This led to the creation of a second Maven plugin for building docker images, dockerfile-maven, which we think offers a simpler mental model of working with Docker from Maven, for all of the reasons outlined in dockerfile-maven's README.

Purpose

You can use this plugin to create a Docker image with artifacts built from your Maven project. For example, the build process for a Java service can output a Docker image that runs the service.

Setup

You can specify the base image, entry point, cmd, maintainer and files you want to add to your image directly in the pom, without needing a separate Dockerfile. If you need VOLUME command(or any other not supported dockerfile command), then you will need to create a Dockerfile and use the dockerDirectory element.

By default the plugin will try to connect to docker on localhost:2375. Set the DOCKER_HOST environment variable to connect elsewhere.

DOCKER_HOST=tcp://<host>:2375

Other docker-standard environment variables are honored too such as TLS and certificates.

Specify build info in the POM

This example creates a new image named example, copies the project's jar file into the image, and sets an entrypoint which runs the jar. Change VERSION GOES HERE to the latest tagged version.

<build>
  <plugins>
    ...
    <plugin>
      <groupId>com.spotify</groupId>
      <artifactId>docker-maven-plugin</artifactId>
      <version>VERSION GOES HERE</version>
      <configuration>
        <imageName>example</imageName>
        <baseImage>java</baseImage>
        <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
        <!-- copy the service's jar file from target into the root directory of the image --> 
        <resources>
           <resource>
             <targetPath>/</targetPath>
             <directory>${project.build.directory}</directory>
             <include>${project.build.finalName}.jar</include>
           </resource>
        </resources>
      </configuration>
    </plugin>
    ...
  </plugins>
</build>

Use a Dockerfile

To use a Dockerfile, you must specify the dockerDirectory element. If specified, the baseImage, maintainer, cmd and entryPoint elements will be ignored. The contents of the dockerDirectory will be copied into ${project.build.directory}/docker. Use the resources element to copy additional files, such as the service's jar file.

<build>
  <plugins>
    ...
    <plugin>
      <groupId>com.spotify</groupId>
      <artifactId>docker-maven-plugin</artifactId>
      <version>VERSION GOES HERE</version>
      <configuration>
        <imageName>example</imageName>
        <dockerDirectory>docker</dockerDirectory>
        <resources>
           <resource>
             <targetPath>/</targetPath>
             <directory>${project.build.directory}</directory>
             <include>${project.build.finalName}.jar</include>
           </resource>
        </resources>
      </configuration>
    </plugin>
    ...
  </plugins>
</build>

Usage

You can build an image with the above configurations by running this command.

mvn clean package docker:build

To push the image you just built to the registry, specify the pushImage flag.

mvn clean package docker:build -DpushImage

To push only specific tags of the image to the registry, specify the pushImageTag flag.

mvn clean package docker:build -DpushImageTag

In order for this to succeed, at least one imageTag must be present in the config, multiple tags can be used.

<build>
  <plugins>
    ...
    <plugin>
      <configuration>
        ...
        <imageTags>
           <imageTag>${project.version}</imageTag>
           <imageTag>latest</imageTag>
        </imageTags>
      </configuration>
    </plugin>
    ...
  </plugins>
</build>

Optionally, you can force docker to overwrite your image tags on each new build:

<build>
  <plugins>
    ...
    <plugin>
      <configuration>
        ...
        <!-- optionally overwrite tags every time image is built with docker:build -->
        <forceTags>true</forceTags>
        <imageTags>
           ...
        </imageTags>
      </configuration>
    </plugin>
    ...
  </plugins>
</build>

Tags-to-be-pushed can also be specified directly on the command line with

mvn ... docker:build -DpushImageTag -DdockerImageTags=latest,another-tag

Bind Docker commands to Maven phases

You can also bind the build, tag & push goals to the Maven phases, so the container will be built, tagged and pushed when you run just mvn deploy. If you have a multi-module project where a sub-module builds an image, you will need to do this binding so the image gets built when maven is run from the parent project.

<plugin>
  <groupId>com.spotify</groupId>
  <artifactId>docker-maven-plugin</artifactId>
  <version>VERSION GOES HERE</version>
  <executions>
    <execution>
      <id>build-image</id>
      <phase>package</phase>
      <goals>
        <goal>build</goal>
      </goals>
    </execution>
    <execution>
      <id>tag-image</id>
      <phase>package</phase>
      <goals>
        <goal>tag</goal>
      </goals>
      <configuration>
        <image>my-image:${project.version}</image>
        <newName>registry.example.com/my-image:${project.version}</newName>
      </configuration>
    </execution>
    <execution>
      <id>push-image</id>
      <phase>deploy</phase>
      <goals>
        <goal>push</goal>
      </goals>
      <configuration>
        <imageName>registry.example.com/my-image:${project.version}</imageName>
      </configuration>
    </execution>        
  </executions>
</plugin>

You can skip Docker goals bound to Maven phases with:

  • -DskipDockerBuild to skip image build
  • -DskipDockerTag to skip image tag
  • -DskipDockerPush to skip image push
  • -DskipDocker to skip any Docker goals

To remove the image named foobar run the following command:

mvn docker:removeImage -DimageName=foobar

For a complete list of configuration options run: mvn com.spotify:docker-maven-plugin:<version>:help -Ddetail=true

Using with Private Registries

To push an image to a private registry, Docker requires that the image tag being pushed is prefixed with the hostname and port of the registry. For example to push my-image to registry.example.com, the image needs to be tagged as registry.example.com/my-image.

The simplest way to do this with docker-maven-plugin is to put the registry name in the <imageName> field, for example

<plugin>
  <groupId>com.spotify</groupId>
  <artifactId>docker-maven-plugin</artifactId>
  <configuration>
    <imageName>registry.example.com/my-image</imageName>
    ...

Then when pushing the image with either docker:build -DpushImage or docker:push, the docker daemon will push to registry.example.com.

Alternatively, if you wish to use a short name in docker:build you can use docker:tag -DpushImage to tag the just-built image with the full registry hostname and push it. It's important to use the pushImage flag as using docker:push independently will attempt to push the original image.

For example:

<plugin>
  <groupId>com.spotify</groupId>
  <artifactId>docker-maven-plugin</artifactId>
  <configuration>
    <imageName>my-image</imageName>
    ...
  </configuration>
  <executions>
    <execution>
      <id>build-image</id>
      <phase>package</phase>
      <goals>
        <goal>build</goal>
      </goals>
    </execution>
    <execution>
      <id>tag-image</id>
      <phase>package</phase>
      <goals>
        <goal>tag</goal>
      </goals>
      <configuration>
        <image>my-image</image>
        <newName>registry.example.com/my-image</newName>
      </configuration>
    </execution>
  </executions>
</plugin>

Authentication

Since version 1.0.0, the docker-maven-plugin will automatically use any authentication present in the docker-cli configuration file at ~/.dockercfg or ~/.docker/config.json, without the need to configure anything (in earlier versions of the plugin this behavior had to be enabled with <useConfigFile>true</useConfigFile>, but now it is always active).

Additionally the plugin will enable support for Google Container Registry if it is able to successfully load Google's "Application Default Credentials". The plugin will also load Google credentials from the file pointed to by the environment variable DOCKER_GOOGLE_CREDENTIALS if it is defined. Since GCR authentication requires retrieving short-lived access codes for the given credentials, support for this registry is baked into the underlying docker-client rather than having to first populate the docker config file before running the plugin.

Lastly, authentication credentials can be explicitly configured in your pom.xml and in your Maven installation's settings.xml file as part of the <servers></servers> block.

<servers>
  <server>
    <id>docker-hub</id>
    <username>foo</username>
    <password>secret-password</password>
    <configuration>
      <email>[email protected]</email>
    </configuration>
  </server>
</servers>

Now use the server id in your project pom.xml.

<plugin>
  <plugin>
    <groupId>com.spotify</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>VERSION GOES HERE</version>
    <configuration>
      [...]
      <serverId>docker-hub</serverId>
      <registryUrl>https://index.docker.io/v1/</registryUrl>
    </configuration>
  </plugin>
</plugins>

The plugin gives priority to any credentials in the docker-cli config file before explicitly configured credentials.

Using encrypted passwords for authentication

Credentials can be encrypted using Maven's built in encryption function. Only passwords enclosed in curly braces will be considered as encrypted.

<servers>
  <server>
    <id>docker-hub</id>
    <username>foo</username>
    <password>{gc4QPLrlgPwHZjAhPw8JPuGzaPitzuyjeBojwCz88j4=}</password>
  </server>
</servers>

Testing

Make sure Docker daemon is running and that you can do docker ps. Then run mvn clean test.

Releasing

Commits to the master branch will trigger our continuous integration agent to build the jar and release by uploading to Sonatype. If you are a project maintainer with the necessary credentials, you can also build and release locally by running the below.

mvn release:clean
mvn release:prepare
mvn release:perform

Known Issues

Exception caught: system properties: docker has type STRING rather than OBJECT

Because the plugin uses Maven properties named like docker.build.defaultProfile, if you declare any other Maven property with the name docker you will get a rather strange-looking error from Maven:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.0.21:build (default) on project <....>: 
Exception caught: system properties: docker has type STRING rather than OBJECT

To fix this, rename the docker property in your pom.xml.

InternalServerErrorException: HTTP 500 Internal Server Error

Problem: when building the Docker image, Maven outputs an exception with a stacktrace like:

Caused by: com.spotify.docker.client.shaded.javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error

docker-maven-plugin communicates with your local Docker daemon using the HTTP Remote API and any unexpected errors that the daemon encounters will be reported as 500 Internal Server Error.

Check the Docker daemon log (typically at /var/log/docker.log or /var/log/upstart/docker.log) for more details.

Invalid repository name ... only [a-z0-9-_.] are allowed

One common cause of 500 Internal Server Error is attempting to build an image with a repository name containing uppercase characters, such as if the <imageName> in the plugin's configuration refers to ${project.version} when the Maven project version is ending in SNAPSHOT.

Consider putting the project version in an image tag (instead of repository name) with the <dockerImageTags> configuration option instead.

docker-maven-plugin's People

Contributors

cblomqvist avatar christianhersevoort avatar craykg avatar cstettler avatar cthiebault avatar danielnorberg avatar davidxia avatar dawidmalina avatar detached avatar dflemstr avatar gidzzz avatar hrmohr avatar jgeorgeson avatar jmkgreen avatar justinharringa avatar kvfedorov avatar lndbrg avatar marc-christian-schulze avatar mattnworb avatar mattreyuk avatar nudgegoonies avatar officialpatterson avatar rbedemann avatar rculbertson avatar rohansingh avatar ront avatar spotify-helios-ci-agent avatar thomas-2020 avatar unicolet avatar velo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-maven-plugin's Issues

add configuration to not fail if dockerFile absent

our project is gradually rolling docker container build and release.
We do it one project at a time. I tried to add plugin declaration (actual plugin, not plugin management) to all projects and expected docker build to only trigger for the projects actually having a dockerFile.
But the plugin fails when docker file is absent.
It would be nice if we could configure something like dockerFailIfDockerFileAbsent=false (default value would be true).

Builds fail on docker 1.4.1

When building with docker 1.4.1, we get the following error:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.6:build (default-cli) on project testproject: Exception caught: Request error: POST unix://localhost:80/v1.12/build?t=DPIT: 500: HTTP 500 Internal Server Error -> [Help 1]

This seems related to (but not the same as) spotify/docker-client#43

Parallel build compatibility

Hi.

During parallel builds, I get:
docker-maven-plugin:0.2.11:build (default) on project x: Exception caught: java.net.SocketException: Socket closed

mvn -T 1C package

"No such file or directory"

Hi,

I'm trying to use this plugin on my CI server and I got the following error:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.3-contaazul-1:build (default) on project heimdall-dist: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: No such file or directory -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.2.3-contaazul-1:build (default) on project heimdall-dist: Exception caught
    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:108)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:188)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:184)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception caught
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:117)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:79)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 11 more
Caused by: com.spotify.docker.client.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: No such file or directory
    at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:1070)
    at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:1010)
    at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:787)
    at com.spotify.docker.BuildMojo.buildImage(BuildMojo.java:456)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:263)
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:115)
    ... 14 more
Caused by: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: No such file or directory
    at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:306)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:293)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
    at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:1008)
    ... 18 more
Caused by: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: No such file or directory
    at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:517)
    at org.glassfish.jersey.apache.connector.ApacheConnector$1.run(ApacheConnector.java:527)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at jersey.repackaged.com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:293)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:49)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:45)
    at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:523)
    at org.glassfish.jersey.client.ClientRuntime$1.run(ClientRuntime.java:169)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:320)
    at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:201)
    ... 5 more
Caused by: java.io.IOException: No such file or directory
    at jnr.unixsocket.UnixSocketChannel.doConnect(UnixSocketChannel.java:94)
    at jnr.unixsocket.UnixSocketChannel.connect(UnixSocketChannel.java:102)
    at com.spotify.docker.client.ApacheUnixSocket.connect(ApacheUnixSocket.java:71)
    at com.spotify.docker.client.UnixConnectionSocketFactory.connectSocket(UnixConnectionSocketFactory.java:78)
    at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:469)
    ... 20 more

How can I figure out which file or directory is missing?

Better feedback on error

I recently had an issue creating an image using the docker-maven-plugin. It was simply that the Dockerfile was not copied to the working directory but it only happened on the CI server. My problem here is that the feedback I got from Maven was not really useful at all:

[INFO] Building image evollis/middle-business:049daf7
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[CUT]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.905 s
[INFO] Finished at: 2015-07-31T17:13:45+00:00
[INFO] Final Memory: 91M/1164M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.12:build (docker-image-create) on project xxx: Exception caught: Request error: POST unix://localhost:80/build?t=evollis/middle-business:049daf7: 500: HTTP 500 Internal Server Error -> [Help 1]

I don't know if it is possible to get more feedback from the docker daemon but that'll have been great to get the underlying error message

Issue while building docker image

I am stuck at the below error while trying to build the docker image. I was using 0.1.1 maven plugin, but even after 0.2.6 there has been no help. Can anyone please tell how to solve this?

Caused by: com.spotify.docker.client.shaded.javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:968)
at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:795)
at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:91)
at org.glassfish.jersey.client.JerseyInvocation$5.completed(JerseyInvocation.java:756)
at org.glassfish.jersey.client.ClientRuntime.processResponse(ClientRuntime.java:189)
at org.glassfish.jersey.client.ClientRuntime.access$300(ClientRuntime.java:74)
at org.glassfish.jersey.client.ClientRuntime$1.run(ClientRuntime.java:171)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:320)
at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:201)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

docker:push fails

When I try mvn docker:push, get this error:

[INFO] Pushing mtbridge/vertx-sample-client:1.0.0
The push refers to a repository [mtbridge/vertx-sample-client] (len: 1)
Sending image list
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.796s
[INFO] Finished at: Mon Feb 23 19:31:27 IST 2015
[INFO] Final Memory: 10M/158M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.1.1:push (default-cli) on project vertx-sample-client: Exception caught: Error: Status 401 trying to push repository mtbridge/vertx-sample-client: "" -> [Help 1]

Docker daemon is running with default settings on the localhost (DOCKER_HOST is not set)

Relevant extract from pom.xml:

            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.1.1</version>
                <configuration>
                    <imageName>${docker.image.prefix}/${project.artifactId}:${project.version}</imageName>
                    <dockerDirectory>docker</dockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/mods</targetPath>
                            <directory>${project.build.directory}/mods</directory>
                        </resource>
                     </resources>
                </configuration>
            </plugin>

Plugin doesn't work on Windows - wrong path handling

Running the plugin on Windows (yes...) ends with following error (stacktrace enabled):

[INFO] --- docker-maven-plugin:0.2.5:build (build) @ my-service ---
[INFO] Copying c:\devel\myorg\cc\my-service\target\my-service-war-exec.jar -> c:\devel\myorg\cc\my-service\target\docker\my-service-war-exec.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.007s
[INFO] Finished at: Thu Apr 09 22:22:05 CEST 2015
[INFO] Final Memory: 35M/346M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.5:build (build) on project my-service: Exception caught: UNC path is missing sharename: /\my-service-war-exec.jar -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.2.5:build (build) on project my-service: Exception caught
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        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:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        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:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception caught
        at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:65)
        at com.spotify.docker.BuildMojo.execute(BuildMojo.java:79)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: java.nio.file.InvalidPathException: UNC path is missing sharename: /\my-service-war-exec.jar
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:118)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
        at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
        at java.nio.file.Paths.get(Paths.java:84)
        at com.spotify.docker.BuildMojo.copyResources(BuildMojo.java:570)
        at com.spotify.docker.BuildMojo.execute(BuildMojo.java:254)
        at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:63)
        ... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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
c:\devel\myorg\cc\my-service>

Plugin configuration used for that project is as follows:

<configuration>
    <baseImage>${docker-registry}/lightweight/oracle-java-7-debian</baseImage>
    <cmd>java -jar /${project.name}-war-exec.jar</cmd>
    <exposes>
        <expose>8080</expose>
    </exposes>
    <resources>
        <resource>
            <targetPath>/</targetPath>
            <directory>${project.build.directory}</directory>
            <include>${project.build.finalName}-war-exec.jar</include>
        </resource>
    </resources>
</configuration>

Build error: rootfs is not within rootfs

I'm trying to build a Docker image on Ubuntu 14.04 with Docker. After perform the first few Dockerfile commands (like ENV and EXPOSE), the build fails on the first RUN command with the error:

Failed to execute goal com.spotify:docker-maven-plugin:0.1.1:build (default-cli) on project aurin-acs: Exception caught: /var/lib/docker/devicemapper/mnt/f321eb950c89681d9ca92add1a44f12926e3012cb6e9851f22d747a3f0c24de8/rootfs is not within /var/lib/docker/devicemapper/mnt/f321eb950c89681d9ca92add1a44f12926e3012cb6e9851f22d747a3f0c24de8/rootfs

I'm not sure if this is an issue with Docker or the Maven plugin, but I haven't seen it before or outside of Maven.

Docker version:

Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a

DOCKER Build Failure

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Copying /home/tcstarget/target/myproject-0.0.1-SNAPSHOT.jar -> /home/tcstarget/target/docker/myproject-0.0.1-SNAPSHOT.jar
[INFO] No resources will be copied, no files match specified patterns
[INFO] Building image dockertest
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:00.259s
[INFO] Finished at: Thu Aug 27 15:28:15 CDT 2015
[INFO] Final Memory: 27M/205M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.3:build (default-cli) on project myproject: Exception caught: Request error: POST unix://localhost:80/v1.12/build?t=dockertest: 500: HTTP 500 Internal Server Error -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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

SNAPSHOT build

Hi,
You did great job with this plugin. Wondering if the SNAPSHOT version is available somewhere, because I need a feature been added on master but not yet released.

Cheers.

Docker tag with force option

Hi, I'd like to make 'latest' tag in addition to each released version of my docker image. I could do that by using build goal with configuration. However, there is no way to enable force option for tagging.
My current workaround is to have 3 separate executions (all binded to package phase): build, remove latest tag image, and tag builded image with latest.

How to add Data volumes in POM

Is it a missing feature ?
example:

<configuration>
        <imageName>example</imageName>
        <baseImage>java</baseImage>
        <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
        <volumes>
              <volume>/data1</volume>
              <volume>/data2</volume>
        </volumes>

tcp protocol is not supported

in my mac os. run the mvn clean install
what's happend

[INFO] Building image example
ๅ…ซๆœˆ 01, 2015 4:33:20 ไธ‹ๅˆ org.apache.http.impl.execchain.RetryExec execute
ไฟกๆฏ: I/O exception (org.apache.http.conn.UnsupportedSchemeException) caught when processing request to {}->tcp://192.168.99.100:2376: tcp protocol is not supported
ๅ…ซๆœˆ 01, 2015 4:33:20 ไธ‹ๅˆ org.apache.http.impl.execchain.RetryExec execute
ไฟกๆฏ: Retrying request to {}->tcp://192.168.99.100:2376
ๅ…ซๆœˆ 01, 2015 4:33:20 ไธ‹ๅˆ org.apache.http.impl.execchain.RetryExec execute
ไฟกๆฏ: I/O exception (org.apache.http.conn.UnsupportedSchemeException) caught when processing request to {}->tcp://192.168.99.100:2376: tcp protocol is not supported
ๅ…ซๆœˆ 01, 2015 4:33:20 ไธ‹ๅˆ org.apache.http.impl.execchain.RetryExec execute
ไฟกๆฏ: Retrying request to {}->tcp://192.168.99.100:2376
ๅ…ซๆœˆ 01, 2015 4:33:20 ไธ‹ๅˆ org.apache.http.impl.execchain.RetryExec execute
ไฟกๆฏ: I/O exception (org.apache.http.conn.UnsupportedSchemeException) caught when processing request to {}->tcp://192.168.99.100:2376: tcp protocol is not supported
ๅ…ซๆœˆ 01, 2015 4:33:20 ไธ‹ๅˆ org.apache.http.impl.execchain.RetryExec execute
ไฟกๆฏ: Retrying request to {}->tcp://192.168.99.100:2376
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.482s
[INFO] Finished at: Sat Aug 01 16:33:20 CST 2015
[INFO] Final Memory: 44M/698M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.12:build (default) on project micro-service-campaign: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.conn.UnsupportedSchemeException: tcp protocol is not supported -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 

Authentication Error When Pushing to Private Repo

I'm trying to push my container to my private registry.I've added the URL and server ID to the pom file:

<serverId>private-docker</serverId>
<registryUrl>http://[private ip]:5000/v2/</registryUrl>

Then I added my username and password to my settings.xml file, as suggested. With this setup, I receive the following error:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.11:build (default-cli) on project jfinsys-vandelay: Exception caught: Incomplete Docker registry authorization credentials. Please provide all of username, password, and email or none. -> [Help 1]

If I add my email to the settings.xml file, I get an error, too, since email is not an acceptable tag for server:

Unrecognised tag: 'email' (position: START_TAG seen ...</password>\n    <email>... @10:12) 

If I remove the username/pw altogether, the error is that Authentication is required:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.11:build (default-cli) on project jfinsys-vandelay: Exception caught: Error pushing to registry: Authentication is required. -> [Help 1]

This is all a test setup now, to try to figure out how it works. So authentication is not required on the server. It will actually just look to see that authentication is included in the header, but not care what is in there.

build hangs when project is not under git control

using version 0.2.11 my docker:build goal freezes. After debugging I discovered that line 216 in BuildMojo.class was the cullprit :
final String commitId = git.isRepository() ? git.getCommitId() : null;

After adding my project to Git the build ran fine.
OS is Ubuntu 14.04

Bug: NPEx when using serverId

on my POM I have this

    <build>
...
        <plugins>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.2.8</version>
                    <configuration>
                        <serverId>docker-hub</serverId>
...
                    </configuration>
            </plugin>
        </plugins>
    </build>

under my settings.xml (xpath //settings/servers/server) I have this:

    <server>
        <id>docker-hub</id>
        <username>******</username>
        <password>*******</password>
    </server>

when running mvn clean install docker:build I get this errors

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.8:build (default-cli) on project k2: Exception caught: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.2.8:build (default-cli) on project k2: Exception caught
    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:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    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: Exception caught
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:117)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:79)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: java.lang.NullPointerException
    at com.spotify.docker.AbstractDockerMojo.getEmail(AbstractDockerMojo.java:155)
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:86)
    ... 22 more

Empty CMD output

if I do not specify a command, the resulting docker file looks like this. I would expect it to not include the CMD if i do not specify one. I want to just inherit the parent image's CMD, which is how it works if you omit the statement. What do you suggest?

FROM btf/jetty
CMD []
ADD /var/lib/jetty/webapps/api.war /var/lib/jetty/webapps/api.war

Issue while building docker image

I am stuck at the below error while trying to build the docker image. I was using 0.1.1 maven plugin, but even after 0.2.6 there has been no help. Can anyone please tell how to solve this?

Caused by: com.spotify.docker.client.shaded.javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
        at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:968)
        at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:795)
        at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:91)
        at org.glassfish.jersey.client.JerseyInvocation$5.completed(JerseyInvocation.java:756)
        at org.glassfish.jersey.client.ClientRuntime.processResponse(ClientRuntime.java:189)
        at org.glassfish.jersey.client.ClientRuntime.access$300(ClientRuntime.java:74)
        at org.glassfish.jersey.client.ClientRuntime$1.run(ClientRuntime.java:171)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:320)
        at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:201)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

How to push to privately hosted registry?

Hi there,

I'm trying to publish a built image to my privately hosted registry. However, this needs to be associated in the tag for the image as docker.mysite.com:5000/my_service-$version.

The plugin associates ${docker.image.prefix}/${project.artifactId}-${project.version} with the tag even if tag is set to my privately hosted registry.

This prevents me from pushing the image to that registry. I attempted to update with the URL of my private registry, but failed as it tried to push it to a 192.168 IP address.

My guess is that this plugin can auth to a private registry in the docker cloud registry, but it doesn't appear to support pushing to a privately hosted docker registry. Is that correct?

Handling of non-existing image when removing is currently wrong

Currently removal is not protected any more against situation when images are not existing:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.2.12-SNAPSHOT:removeImage (removeImage) on project upload-media-service: Exception caught
        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:108)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
        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: Exception caught
        at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:117)
        at com.spotify.docker.RemoveImageMojo.execute(RemoveImageMojo.java:38)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
Caused by: com.spotify.docker.client.ImageNotFoundException: Image not found: docker-registry.hc.ag/contentfreaks/upload-media-service:latest
        at com.spotify.docker.client.DefaultDockerClient.removeImage(DefaultDockerClient.java:862)
        at com.spotify.docker.RemoveImageMojo.execute(RemoveImageMojo.java:52)
        at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:115)
        ... 22 more

403 When getting the base image from a private registry

Hello,

I managed to push my image to my private registry, setting the configuration in the settings.xml file as per instructions.
Everything works fine if the base image is already pulled using docker pull, but I get a 403 when the base image has to be pulled from scratch.

What I don't get is why the credentials work when I push but not when I pull.
Is there something I'm missing in my reasoning? Are there two different settings for that (I hope not)?

Thanks,
Alessandro

Be able to define working directory

It should be possible to define the current working directory when invoking the docker binary, so that triggers that expect files to be in certain places can be used.

Step 0 : FROM mybaseimage/jetty:latest
[91m# Executing 2 build triggers

Trigger 0, COPY build.properties /tmp/build.properties
Step 0 : COPY build.properties /tmp/build.properties
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

docker:tag fails to find image_info.json if invoked from parent and configured to push

When binding the docker:tag goal to the maven lifecycle phase "deploy" and configuring it to push the tagged images, then the processing of a child module fails with a module exception saying:

target\image_info.json (The system cannot find the path specified)

Find the stacktrace below.

This error seems to be due to loading the image_info.json file via the "target" directory relative to the current working directory instead of relative to the build directory of the current module.

Further validation comes from the fact that when I create a "target" directoy at the level of the aggregator pom, then the push succeeds without error and inside it I find the json file.

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.3.2:tag (push) on project nextservice: Exception caught: target\image_info.json (The system cannot find the path specified) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.3.2:tag (push) on project nextservice: Exception caught
    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:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception caught
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:95)
    at com.spotify.docker.TagMojo.execute(TagMojo.java:44)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 25 more
Caused by: java.io.FileNotFoundException: target\image_info.json (The system cannot find the path specified)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
    at com.spotify.docker.TagMojo.execute(TagMojo.java:116)
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:93)
    ... 28 more

Remove image before building

If this plugin is integrated into a CI server or even a developer's machine, after quite some builds you end up with a lot of dangling images (with name ). This can be avoided by deleting the image just before building, with a call to DockerClient.removeImage

NullPointerException when building with newly-initialized, uncommitted git repo

Having just initialized my sandbox with a git repository I wanted to make sure that my project build before committing. This failed until I completed the repo initialization with a commit.

Relevant stack trace:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.5:build (docker-build) on project docker-tomcat: Exception caught: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.2.5:build (docker-build) on project docker-tomcat: Exception caught
    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:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    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: Exception caught
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:65)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:79)
    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: java.lang.NullPointerException
    at com.spotify.docker.Git.getCommitId(Git.java:71)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:209)
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:63)
    ... 22 more

mvn clean package docker:build failing

Hi ,

So I added these to my pom.xml,to build a docker image of my project.But for some reason it fails.

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>0.2.11</version>
 <configuration>  
       <imageName>nurs-template-engine</imageName>
       <baseImage>java</baseImage>
       <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
     <resources>
           <resource>
                    <targetPath>/</targetPath>
                    <directory>${project.build.directory}</directory>
                    <include>${project.build.finalName}.jar</include>
           </resource>
  </resources>
  </configuration>
</plugin>

I keep having this error. i dont know what it means, i have searched through the web but to no avail.Any help will be much appreciated.

--- docker-maven-plugin:0.2.11:build (default-cli) @ template-engine ---
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Copying /home/dreamadmin/NetBeansProjects/nurs/template-engine/target/template-engine-1.0-SNAPSHOT.jar -> /home/dreamadmin/NetBeansProjects/nurs/template-engine/target/docker/template-engine-1.0-SNAPSHOT.jar
[INFO] Building image nurs-template-engine
Jun 26, 2015 5:36:37 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: Permission denied
Jun 26, 2015 5:36:37 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
Jun 26, 2015 5:36:37 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: Permission denied
Jun 26, 2015 5:36:37 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
Jun 26, 2015 5:36:37 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: Permission denied
Jun 26, 2015 5:36:37 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.777s
[INFO] Finished at: Fri Jun 26 17:36:37 WAT 2015
[INFO] Final Memory: 18M/239M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.11:build (default-cli) on project template-engine: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Permission denied -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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

Thanks in advance

How does one access the git hash in docker:remove

I'd like to attach the docker:remove goal to my project's clean phase with a conditional flag so I can optionally reset the entire environment. Currently we build a container using the artifact id as the short name and tag it with latest, ${project.version}, and the git hash using your plugin's useGitCommitId flag. Is there a way to reference the git short commit id that was used in the build from within the remove goal?

plugin fails to read property "docker"

This is minor issue and I am posting here for others to be aware.

Plugin fails when "docker" property presents in context:
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.0.21:build (default) on project <....>: Exception caught: system properties: docker has type STRING rather than OBJECT

I've defined my own property with name "docker" and it led to a crash. It is easy to fix by using different name, but error was pretty strange and confusing (as I was not aware of plugin uses some properties too and uses typesafe config to parse them).

Would be good to have some sort of namespace specific to plugin to avoid name clashing with other people properties....

Otherwise great work guys ;)

add configuration to skip pom projects

On our project we have a parent pom project specifying plugins (not plugin management) for all children so we don't have to copy/paste them in all children.
I tried to add docker-plugin declaration but it fails since the parent pom does not have a docker file.
It would be nice if we could configure something like -DdockerSkipPomProject=true

Image tag specifier is not used when pushing through build goal

When building an image with a tag using the build goal, and pushImage is set to true, push refers to the tag-less image which results in pushing the latest tag only.

This doesn't work:

      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.0.21</version>
        <executions>
          <execution>
            <id>build</id>
            <phase>package</phase>
            <goals>
              <goal>build</goal>
            </goals>
            <configuration>
              <dockerHost>tcp://docker.host:5555</dockerHost>
              <imageName>docker.registry/image:withtag</imageName>
              <dockerDirectory>${basedir}/src/main/docker</dockerDirectory>
              <pushImage>true</pushImage>
              <resources>
                <resource>
                  <targetPath>.</targetPath>
                  <directory>${project.build.directory}</directory>
                  <include>docker-assembly.tar</include>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>push</id>
            <phase>package</phase>
            <goals>
              <goal>push</goal>
            </goals>
            <configuration>
              <dockerHost>tcp://docker.host:5555</dockerHost>
              <imageName>docker.registry/image:withtag</imageName>
            </configuration>
          </execution>
        </executions>
      </plugin>

By separating the build and push executions it works though:

      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.0.21</version>
        <executions>
          <execution>
            <id>build</id>
            <phase>package</phase>
            <goals>
              <goal>build</goal>
            </goals>
            <configuration>
              <dockerHost>tcp://docker.host:5555</dockerHost>
              <imageName>docker.registry/image:withtag</imageName>
              <dockerDirectory>${basedir}/src/main/docker</dockerDirectory>
              <resources>
                <resource>
                  <targetPath>.</targetPath>
                  <directory>${project.build.directory}</directory>
                  <include>docker-assembly.tar</include>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>push</id>
            <phase>package</phase>
            <goals>
              <goal>push</goal>
            </goals>
            <configuration>
              <dockerHost>tcp://docker.host:5555</dockerHost>
              <imageName>docker.registry/image:withtag</imageName>
            </configuration>
          </execution>
        </executions>
      </plugin>

HTTPS API connection to Docker server not working

My Docker server only allows HTTPS access to the API; in this configuration, using the docker-maven-plugin doesn't appear to work. I'm using version 0.1.1 of the plugin, and my DOCKER_HOST environment variable is set as follows:

DOCKER_HOST="tcp://my.docker.hostname:2376"

Running mvn docker:build results in:

[INFO] ------------------------------------------------------------------------
[INFO] Building iRIS REST API client 1.0.13
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- docker-maven-plugin:0.1.1:build (default-cli) @ irisrestapi-client ---
[INFO] Copying /Volumes/JEL Eclipse/workspace/irisrestapi-client/target/irisrestapi-client-1.0.13-jar-with-dependencies.jar -> /Volumes/JEL Eclipse/workspace/irisrestapi-client/target/docker/irisrestapi-client-1.0.13-jar-with-dependencies.jar
[INFO] Building image nciccroit/irisapiclient:1.0.13
Jan 12, 2015 9:00:31 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://my.docker.hostname:2376: Broken pipe
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.459 s
[INFO] Finished at: 2015-01-12T21:00:31-05:00
[INFO] Final Memory: 20M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.1.1:build (default-cli) on project irisrestapi-client: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.client.ClientProtocolException: Cannot retry request with a non-repeatable request entity: Broken pipe -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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

From issues #31 and #34, I thought that the current version of the plugin (0.1.1) would contain the fixes referenced in #31... am I mistaken? Or is this another error entirely?

Of note, I've verified that my client and server both are on the same Docker version (1.4.1):

$ docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): darwin/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8

(I've seen reference online that that broken pipe error could be related to different client & server versions, but that's not the case here.)

Thanks in advance...

Bad file descriptor when building multi-module project

Hi,

I have a project with multiple modules and when I build it using multiple threads (-T2) I get the following error:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.13-SNAPSHOT:build (default) on project company-project: Exception caught: java.io.IOException: Bad file descriptor -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.2.13-SNAPSHOT:build (default) on project company-project: Exception caught
    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.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:189)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:185)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception caught
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:116)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:78)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 11 more
Caused by: com.spotify.docker.client.DockerException: java.io.IOException: Bad file descriptor
    at com.spotify.docker.client.ProgressStream.hasNextMessage(ProgressStream.java:57)
    at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:818)
    at com.spotify.docker.BuildMojo.buildImage(BuildMojo.java:465)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:270)
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:114)
    ... 14 more
Caused by: java.io.IOException: Bad file descriptor
    at jnr.enxio.channels.NativeSocketChannel.read(NativeSocketChannel.java:82)
    at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:59)
    at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
    at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
    at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)
    at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)
    at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270)
    at org.apache.http.impl.io.AbstractMessageParser.parseHeaders(AbstractMessageParser.java:192)
    at org.apache.http.impl.io.AbstractMessageParser.parseHeaders(AbstractMessageParser.java:145)
    at org.apache.http.impl.io.ChunkedInputStream.parseTrailerHeaders(ChunkedInputStream.java:264)
    at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:214)
    at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:169)
    at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
    at java.io.FilterInputStream.read(FilterInputStream.java:133)
    at org.glassfish.jersey.message.internal.EntityInputStream.read(EntityInputStream.java:101)
    at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream.read(ReaderInterceptorExecutor.java:300)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.core.json.UTF8StreamJsonParser.loadMore(UTF8StreamJsonParser.java:169)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._skipWSOrEnd(UTF8StreamJsonParser.java:2495)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:617)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.MappingIterator.hasNextValue(MappingIterator.java:159)
    at com.spotify.docker.client.ProgressStream.hasNextMessage(ProgressStream.java:53)
    ... 18 more

I created a test that simulates the problem at:
velo@a599b7b
(note it uses maven 3.3.3 maven.config to set -T10 velo@a599b7b#diff-d235c7fd6aa195ea001067a1e7113ce5R1)

I looked around and seems something that blows inside docker. Since at the moment I can not investigate it further, I can up with a lock to prevent 2 docker images being built at the exact same time:
velo@cb099b6

If that is acceptable and you guys would like to incorporate to this project:
#114

ADD command incorrect for tar.gz files

Adding a tar.gz file creates an ADD command which causes an extra directory to be created with the same name as the tar.gz in the target path. The expected behavior is that the archive would be extracted in the target path.

<resource>
    <directory>${project.build.directory}</directory>
    <include>${project.artifactId}.tar.gz</include>
    <targetPath>/opt/apps/</targetPath>
</resource>

Creates the following command during build

ADD /opt/apps/spar-api.tar.gz /opt/apps/spar-api.tar.gz

Which results in /opt/apps/spar-api.tar.gz/<contents of archive> where it should be /opt/apps/<contents of archive>

Add possibility to add dependencies to the image

It is now possible to add resources defined in the project, but it is not possible to add a dependency to an image. If I have a project that has a dependency on artifactX, I want to have that artifactX in the generated image. Right now, you have to combine multiple plugins to have the dependency as a resource and then being able to add the resource. It would be nice to be able to explicitly declare a dependency as a <resource>. See maven assembly plugin and the assembly descriptor.

How to copy & rename a resource?

I am using a Dockerfile configuration and would like to have a standard name for the artifact I am deploying to the image (e.g. myapp.war). The resource entry only allows me to copy the artifact. I understand I can change the pom to change the final artifact id, but I would not like to do that.

<resource>
    <targetPath>/</targetPath>
    <directory>${project.build.directory}</directory>
    <include>${project.build.finalName}.${project.packaging}</include>
</resource>

And my Dockerfile:

COPY /myapp.war /tomcat/webapps/

ProcessingException: java.net.SocketException: Connection reset

Hi,

I have an issue with using this plugin after updating to the latest boot2docker version. Here are the steps to reproduce it (hopefully). The output + error is also shown below.

  1. Install latest boot2docker from boot2docker.io

  2. Start boot2docker

  3. Setup environment by running: $(boot2docker shellinit)

  4. Output of env | grep -i DOCKER_

    DOCKER_HOST=tcp://192.168.59.103:2376
    DOCKER_TLS_VERIFY=1
    DOCKER_CERT_PATH=/Users/mattijs/.boot2docker/certs/boot2docker-vm

  5. Output of boot2docker version

    Boot2Docker-cli version: v1.3.1
    Git commit: 57ccdb8

  6. Output of docker version

    Client version: 1.3.1
    Client API version: 1.15
    Go version (client): go1.3.3
    Git commit (client): 4e9bbfa
    OS/Arch (client): darwin/amd64
    Server version: 1.3.1
    Server API version: 1.15
    Go version (server): go1.3.3
    Git commit (server): 4e9bbfa

I have a pom.xml sample project containing the following basic plugin configuration:

<plugin>
  <groupId>com.spotify</groupId>
  <artifactId>docker-maven-plugin</artifactId>
  <version>0.0.23</version>
  <configuration>
    <imageName>example</imageName>
    <dockerDirectory>docker</dockerDirectory>
    <resources>
       <resource>
         <targetPath>/</targetPath>
         <directory>${project.build.directory}</directory>
         <include>${project.build.finalName}.jar</include>
       </resource>
    </resources>
  </configuration>
</plugin>

When I execute mvn docker:build I get the following output / error:

bash-4.3$ mvn docker:build
[INFO] Scanning for projects...
...
[INFO] ------------------------------------------------------------------------
[INFO] Building docker-test-project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- docker-maven-plugin:0.0.23:build (default-cli) @ docker-test-project ---
[INFO] Copying /private/tmp/docker-test-project/target/docker-test-project-0.0.1-SNAPSHOT.jar -> /private/tmp/docker-test-project/target/docker/docker-test-project-0.0.1-SNAPSHOT.jar
[INFO] Building image example
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.579 s
[INFO] Finished at: 2014-11-08T22:13:01+01:00
[INFO] Final Memory: 15M/156M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.0.23:build (default-cli) on project docker-test-project: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.net.SocketException: Connection reset -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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
bash-4.3$ 

With full debug logging:

bash-4.3$ mvn docker:build -X
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)
Maven home: /usr/local/Cellar/maven/3.2.1/libexec
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/local/Cellar/maven/3.2.1/libexec/conf/settings.xml
[DEBUG] Reading user settings from /Users/mattijs/.m2/settings.xml
[DEBUG] Using local repository at /Users/mattijs/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/mattijs/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.docker.test:docker-test-project:jar:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
[DEBUG] Resolving plugin prefix docker from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix docker to com.spotify:docker-maven-plugin from POM com.docker.test:docker-test-project:jar:0.0.1-SNAPSHOT
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.docker.test:docker-test-project:jar:0.0.1-SNAPSHOT
[DEBUG] Tasks:   [docker:build]
[DEBUG] Style:   Regular
[DEBUG] =======================================================================
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building docker-test-project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Resolving plugin prefix docker from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix docker to com.spotify:docker-maven-plugin from POM com.docker.test:docker-test-project:jar:0.0.1-SNAPSHOT
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project:       com.docker.test:docker-test-project:0.0.1-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] Repositories (dependencies): [central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] Repositories (plugins)     : [central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          com.spotify:docker-maven-plugin:0.0.23:build (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <baseImage>java</baseImage>
  <buildDirectory>${project.build.directory}</buildDirectory>
  <cmd>${dockerCmd}</cmd>
  <defaultProfile>${dockerDefaultBuildProfile}</defaultProfile>
  <dockerDirectory>${dockerDirectory}</dockerDirectory>
  <dockerHost>${dockerHost}</dockerHost>
  <entryPoint>[&quot;java&quot;, &quot;-jar&quot;, &quot;/docker-test-project-0.0.1-SNAPSHOT.jar&quot;]</entryPoint>
  <env>${dockerEnv}</env>
  <exposes>${dockerExposes}</exposes>
  <imageName>example</imageName>
  <maintainer>${dockerMaintainer}</maintainer>
  <profile>${dockerBuildProfile}</profile>
  <pushImage default-value="false">${pushImage}</pushImage>
  <resources>
    <resource>
      <targetPath>/</targetPath>
      <directory>/private/tmp/docker-test-project/target</directory>
      <include>docker-test-project-0.0.1-SNAPSHOT.jar</include>
    </resource>${dockerResources}</resources>
  <skipDockerBuild default-value="false">${skipDockerBuild}</skipDockerBuild>
  <tagInfoFile default-value="${project.build.testOutputDirectory}/image_info.json">${tagInfoFile}</tagInfoFile>
  <useGitCommitId default-value="false">${useGitCommitId}</useGitCommitId>
  <execution default-value="${mojoExecution}"/>
  <session default-value="${session}"/>
</configuration>
[DEBUG] =======================================================================
[INFO] 
[INFO] --- docker-maven-plugin:0.0.23:build (default-cli) @ docker-test-project ---
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG]   Imported: org.eclipse.aether.impl < plexus.core
[DEBUG]   Imported: org.apache.maven.exception < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG]   Imported: org.eclipse.aether.version < plexus.core
[DEBUG]   Imported: org.eclipse.aether.metadata < plexus.core
[DEBUG]   Imported: org.eclipse.aether.collection < plexus.core
[DEBUG]   Imported: org.apache.maven.monitor < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG]   Imported: org.apache.maven.repository < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG]   Imported: org.apache.maven.profiles < plexus.core
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
[DEBUG]   Imported: org.apache.maven.execution.scope < plexus.core
[DEBUG]   Imported: org.eclipse.aether.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.execution < plexus.core
[DEBUG]   Imported: org.apache.maven.reporting < plexus.core
[DEBUG]   Imported: org.apache.maven.usability < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.container < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.component < plexus.core
[DEBUG]   Imported: org.eclipse.aether.transfer < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG]   Imported: org.eclipse.aether.* < plexus.core
[DEBUG]   Imported: org.eclipse.aether.graph < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG]   Imported: org.eclipse.aether.internal.impl < plexus.core
[DEBUG]   Imported: org.eclipse.aether.repository < plexus.core
[DEBUG]   Imported: org.eclipse.aether.resolution < plexus.core
[DEBUG]   Imported: javax.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.settings < plexus.core
[DEBUG]   Imported: org.codehaus.classworlds < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
[DEBUG]   Imported: org.eclipse.aether.spi < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG]   Imported: org.apache.maven.configuration < plexus.core
[DEBUG]   Imported: org.apache.maven.cli < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.context < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG]   Imported: org.apache.maven.project < plexus.core
[DEBUG]   Imported: org.eclipse.aether.installation < plexus.core
[DEBUG]   Imported: org.eclipse.aether.deployment < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG]   Imported: org.apache.maven.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.model < plexus.core
[DEBUG]   Imported: org.slf4j.* < plexus.core
[DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.* < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.* < plexus.core
[DEBUG]   Imported: org.apache.maven.plugin < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG] Populating class realm maven.api
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=1, ConflictMarker.nodeCount=102, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=1, ConflictIdSorter.conflictIdCount=57, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=19, ConflictResolver.conflictItemCount=97, DefaultDependencyCollector.collectTime=462, DefaultDependencyCollector.transformTime=24}
[DEBUG] com.spotify:docker-maven-plugin:jar:0.0.23:
[DEBUG]    com.spotify:docker-client:jar:2.6.4:compile
[DEBUG]       org.slf4j:slf4j-api:jar:1.7.6:compile
[DEBUG]       com.google.guava:guava:jar:12.0.1:compile
[DEBUG]          com.google.code.findbugs:jsr305:jar:1.3.9:compile
[DEBUG]       org.apache.commons:commons-compress:jar:1.8.1:compile
[DEBUG]       org.apache.httpcomponents:httpclient:jar:4.3.5:compile
[DEBUG]          org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[DEBUG]          commons-logging:commons-logging:jar:1.1.3:compile
[DEBUG]          commons-codec:commons-codec:jar:1.6:compile
[DEBUG]       de.gesellix:unix-socket-factory:jar:2014-09-26T18-52-33:compile
[DEBUG]          org.codehaus.groovy:groovy-all:jar:2.3.6:runtime
[DEBUG]          org.codehaus.groovy.modules.http-builder:http-builder:jar:0.7.1:runtime
[DEBUG]             net.sf.json-lib:json-lib:jar:jdk15:2.3:runtime
[DEBUG]                commons-beanutils:commons-beanutils:jar:1.8.0:runtime
[DEBUG]                commons-collections:commons-collections:jar:3.2.1:runtime
[DEBUG]                commons-lang:commons-lang:jar:2.4:runtime
[DEBUG]                net.sf.ezmorph:ezmorph:jar:1.0.6:runtime
[DEBUG]             net.sourceforge.nekohtml:nekohtml:jar:1.9.16:runtime
[DEBUG]                xerces:xercesImpl:jar:2.9.1:runtime
[DEBUG]                   xml-apis:xml-apis:jar:1.3.04:runtime
[DEBUG]             xml-resolver:xml-resolver:jar:1.2:runtime
[DEBUG]       org.bouncycastle:bcpkix-jdk15on:jar:1.51:compile
[DEBUG]          org.bouncycastle:bcprov-jdk15on:jar:1.51:compile
[DEBUG]    com.typesafe:config:jar:1.2.0:compile
[DEBUG]    org.apache.maven:maven-core:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-model:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-settings:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-settings-builder:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-plugin-api:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-model-builder:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-aether-provider:jar:3.2.1:compile
[DEBUG]          org.eclipse.aether:aether-spi:jar:0.9.0.M2:compile
[DEBUG]       org.eclipse.aether:aether-impl:jar:0.9.0.M2:compile
[DEBUG]       org.eclipse.aether:aether-api:jar:0.9.0.M2:compile
[DEBUG]       org.eclipse.aether:aether-util:jar:0.9.0.M2:compile
[DEBUG]       org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M5:compile
[DEBUG]          javax.enterprise:cdi-api:jar:1.0:compile
[DEBUG]             javax.annotation:jsr250-api:jar:1.0:compile
[DEBUG]             javax.inject:javax.inject:jar:1:compile
[DEBUG]          org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile
[DEBUG]             aopalliance:aopalliance:jar:1.0:compile
[DEBUG]          org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.0.0.M5:compile
[DEBUG]       org.codehaus.plexus:plexus-interpolation:jar:1.19:compile
[DEBUG]       org.codehaus.plexus:plexus-utils:jar:3.0.17:compile
[DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.5.1:compile
[DEBUG]       org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
[DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
[DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:3.2.1:compile
[DEBUG]    org.eclipse.jgit:org.eclipse.jgit:jar:3.2.0.201312181205-r:compile
[DEBUG]       com.jcraft:jsch:jar:0.1.46:compile
[DEBUG]       com.googlecode.javaewah:JavaEWAH:jar:0.5.6:compile
[DEBUG]    com.fasterxml.jackson.core:jackson-databind:jar:2.2.3:compile
[DEBUG]       com.fasterxml.jackson.core:jackson-annotations:jar:2.2.3:compile
[DEBUG]       com.fasterxml.jackson.core:jackson-core:jar:2.2.3:compile
[DEBUG] Created new class realm plugin>com.spotify:docker-maven-plugin:0.0.23
[DEBUG] Importing foreign packages into class realm plugin>com.spotify:docker-maven-plugin:0.0.23
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>com.spotify:docker-maven-plugin:0.0.23
[DEBUG]   Included: com.spotify:docker-maven-plugin:jar:0.0.23
[DEBUG]   Included: com.spotify:docker-client:jar:2.6.4
[DEBUG]   Included: org.slf4j:slf4j-api:jar:1.7.6
[DEBUG]   Included: com.google.guava:guava:jar:12.0.1
[DEBUG]   Included: com.google.code.findbugs:jsr305:jar:1.3.9
[DEBUG]   Included: org.apache.commons:commons-compress:jar:1.8.1
[DEBUG]   Included: org.apache.httpcomponents:httpclient:jar:4.3.5
[DEBUG]   Included: org.apache.httpcomponents:httpcore:jar:4.3.2
[DEBUG]   Included: commons-logging:commons-logging:jar:1.1.3
[DEBUG]   Included: commons-codec:commons-codec:jar:1.6
[DEBUG]   Included: de.gesellix:unix-socket-factory:jar:2014-09-26T18-52-33
[DEBUG]   Included: org.codehaus.groovy:groovy-all:jar:2.3.6
[DEBUG]   Included: org.codehaus.groovy.modules.http-builder:http-builder:jar:0.7.1
[DEBUG]   Included: net.sf.json-lib:json-lib:jar:jdk15:2.3
[DEBUG]   Included: commons-beanutils:commons-beanutils:jar:1.8.0
[DEBUG]   Included: commons-collections:commons-collections:jar:3.2.1
[DEBUG]   Included: commons-lang:commons-lang:jar:2.4
[DEBUG]   Included: net.sf.ezmorph:ezmorph:jar:1.0.6
[DEBUG]   Included: net.sourceforge.nekohtml:nekohtml:jar:1.9.16
[DEBUG]   Included: xerces:xercesImpl:jar:2.9.1
[DEBUG]   Included: xml-apis:xml-apis:jar:1.3.04
[DEBUG]   Included: xml-resolver:xml-resolver:jar:1.2
[DEBUG]   Included: org.bouncycastle:bcpkix-jdk15on:jar:1.51
[DEBUG]   Included: org.bouncycastle:bcprov-jdk15on:jar:1.51
[DEBUG]   Included: com.typesafe:config:jar:1.2.0
[DEBUG]   Included: org.eclipse.aether:aether-util:jar:0.9.0.M2
[DEBUG]   Included: javax.enterprise:cdi-api:jar:1.0
[DEBUG]   Included: javax.annotation:jsr250-api:jar:1.0
[DEBUG]   Included: javax.inject:javax.inject:jar:1
[DEBUG]   Included: org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0
[DEBUG]   Included: aopalliance:aopalliance:jar:1.0
[DEBUG]   Included: org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.0.0.M5
[DEBUG]   Included: org.codehaus.plexus:plexus-interpolation:jar:1.19
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:3.0.17
[DEBUG]   Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG]   Included: org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3
[DEBUG]   Included: org.sonatype.plexus:plexus-cipher:jar:1.4
[DEBUG]   Included: org.eclipse.jgit:org.eclipse.jgit:jar:3.2.0.201312181205-r
[DEBUG]   Included: com.jcraft:jsch:jar:0.1.46
[DEBUG]   Included: com.googlecode.javaewah:JavaEWAH:jar:0.5.6
[DEBUG]   Included: com.fasterxml.jackson.core:jackson-databind:jar:2.2.3
[DEBUG]   Included: com.fasterxml.jackson.core:jackson-annotations:jar:2.2.3
[DEBUG]   Included: com.fasterxml.jackson.core:jackson-core:jar:2.2.3
[DEBUG]   Excluded: org.apache.maven:maven-core:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-model:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-settings:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-settings-builder:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-model-builder:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-aether-provider:jar:3.2.1
[DEBUG]   Excluded: org.eclipse.aether:aether-spi:jar:0.9.0.M2
[DEBUG]   Excluded: org.eclipse.aether:aether-impl:jar:0.9.0.M2
[DEBUG]   Excluded: org.eclipse.aether:aether-api:jar:0.9.0.M2
[DEBUG]   Excluded: org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M5
[DEBUG]   Excluded: org.codehaus.plexus:plexus-classworlds:jar:2.5.1
[DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:3.2.1
[DEBUG] Configuring mojo com.spotify:docker-maven-plugin:0.0.23:build from plugin realm ClassRealm[plugin>com.spotify:docker-maven-plugin:0.0.23, parent: sun.misc.Launcher$AppClassLoader@77fe0d66]
[DEBUG] Configuring mojo 'com.spotify:docker-maven-plugin:0.0.23:build' with basic configurator -->
[DEBUG]   (f) baseImage = java
[DEBUG]   (f) buildDirectory = /private/tmp/docker-test-project/target
[DEBUG]   (f) entryPoint = ["java", "-jar", "/docker-test-project-0.0.1-SNAPSHOT.jar"]
[DEBUG]   (f) env = {}
[DEBUG]   (f) exposes = []
[DEBUG]   (f) imageName = example
[DEBUG]   (f) pushImage = false
[DEBUG]   (s) targetPath = /
[DEBUG]   (s) directory = /private/tmp/docker-test-project/target
[DEBUG]   (s) include = docker-test-project-0.0.1-SNAPSHOT.jar
[DEBUG]   (f) resources = [Resource {targetPath: /, filtering: false, FileSet {directory: /private/tmp/docker-test-project/target, PatternSet [includes: {docker-test-project-0.0.1-SNAPSHOT.jar}, excludes: {}]}}]
[DEBUG]   (f) skipDockerBuild = false
[DEBUG]   (f) tagInfoFile = /private/tmp/docker-test-project/target/test-classes/image_info.json
[DEBUG]   (f) useGitCommitId = false
[DEBUG]   (f) execution = com.spotify:docker-maven-plugin:0.0.23:build {execution: default-cli}
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@64e362f2
[DEBUG] -- end configuration --
[DEBUG] Not a git repository, cannot get commit ID
[DEBUG] Not using any build profile
[INFO] Copying /private/tmp/docker-test-project/target/docker-test-project-0.0.1-SNAPSHOT.jar -> /private/tmp/docker-test-project/target/docker/docker-test-project-0.0.1-SNAPSHOT.jar
[INFO] Building image example
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.560 s
[INFO] Finished at: 2014-11-08T22:22:57+01:00
[INFO] Final Memory: 18M/156M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.0.23:build (default-cli) on project docker-test-project: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.net.SocketException: Connection reset -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.0.23:build (default-cli) on project docker-test-project: Exception caught
  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:108)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
  at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
  at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
  at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
  at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
  at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
  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: Exception caught
  at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:63)
  at com.spotify.docker.BuildMojo.execute(BuildMojo.java:72)
  at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
  ... 19 more
Caused by: com.spotify.docker.client.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.net.SocketException: Connection reset
  at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:801)
  at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:741)
  at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:626)
  at com.spotify.docker.BuildMojo.buildImage(BuildMojo.java:410)
  at com.spotify.docker.BuildMojo.execute(BuildMojo.java:239)
  at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:61)
  ... 22 more
Caused by: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.net.SocketException: Connection reset
  at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:306)
  at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:293)
  at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
  at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:739)
  ... 26 more
Caused by: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.net.SocketException: Connection reset
  at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:517)
  at org.glassfish.jersey.apache.connector.ApacheConnector$1.run(ApacheConnector.java:527)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  at jersey.repackaged.com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:293)
  at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:49)
  at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:45)
  at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:523)
  at org.glassfish.jersey.client.ClientRuntime$1.run(ClientRuntime.java:169)
  at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
  at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
  at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
  at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
  at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
  at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:320)
  at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:201)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketException: Connection reset
  at java.net.SocketInputStream.read(SocketInputStream.java:196)
  at java.net.SocketInputStream.read(SocketInputStream.java:122)
  at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)
  at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)
  at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270)
  at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
  at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
  at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)
  at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161)
  at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:153)
  at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)
  at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
  at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254)
  at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
  at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
  at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
  at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
  at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:469)
  ... 20 more
[ERROR] 
[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
bash-4.3$ 
...

Can't push image: Error: Status 401 trying to push repository...

I can't seem to push a docker image via the mvn docker:push goal. At the same time I am able to do so successfully via the regular docker push command

I use the following pom.xml: https://gist.github.com/mattijsf/c93be14f3680c9cb96b8

  1. I run mvn docker:build
  2. As a result the image mattijsf/docker-test-project:latest is created
  3. I run mvn docker:push -X. I receive the following output
bash-4.3$ mvn docker:push -X
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)
Maven home: /usr/local/Cellar/maven/3.2.1/libexec
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/local/Cellar/maven/3.2.1/libexec/conf/settings.xml
[DEBUG] Reading user settings from /Users/mattijs/.m2/settings.xml
[DEBUG] Using local repository at /Users/mattijs/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/mattijs/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.docker.test:docker-test-project:pom:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Resolving plugin prefix docker from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix docker to com.spotify:docker-maven-plugin from POM com.docker.test:docker-test-project:pom:0.0.1-SNAPSHOT
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.docker.test:docker-test-project:pom:0.0.1-SNAPSHOT
[DEBUG] Tasks:   [docker:push]
[DEBUG] Style:   Regular
[DEBUG] =======================================================================
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building docker-test-project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Resolving plugin prefix docker from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix docker to com.spotify:docker-maven-plugin from POM com.docker.test:docker-test-project:pom:0.0.1-SNAPSHOT
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project:       com.docker.test:docker-test-project:0.0.1-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] Repositories (dependencies): [central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] Repositories (plugins)     : [central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          com.spotify:docker-maven-plugin:0.0.23:push (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <dockerHost>${dockerHost}</dockerHost>
  <imageName>mattijsf/docker-test-project</imageName>
  <execution default-value="${mojoExecution}"/>
  <session default-value="${session}"/>
</configuration>
[DEBUG] =======================================================================
[INFO] 
[INFO] --- docker-maven-plugin:0.0.23:push (default-cli) @ docker-test-project ---
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG]   Imported: org.eclipse.aether.impl < plexus.core
[DEBUG]   Imported: org.apache.maven.exception < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG]   Imported: org.eclipse.aether.version < plexus.core
[DEBUG]   Imported: org.eclipse.aether.metadata < plexus.core
[DEBUG]   Imported: org.eclipse.aether.collection < plexus.core
[DEBUG]   Imported: org.apache.maven.monitor < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG]   Imported: org.apache.maven.repository < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG]   Imported: org.apache.maven.profiles < plexus.core
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
[DEBUG]   Imported: org.apache.maven.execution.scope < plexus.core
[DEBUG]   Imported: org.eclipse.aether.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.execution < plexus.core
[DEBUG]   Imported: org.apache.maven.reporting < plexus.core
[DEBUG]   Imported: org.apache.maven.usability < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.container < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.component < plexus.core
[DEBUG]   Imported: org.eclipse.aether.transfer < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG]   Imported: org.eclipse.aether.* < plexus.core
[DEBUG]   Imported: org.eclipse.aether.graph < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG]   Imported: org.eclipse.aether.internal.impl < plexus.core
[DEBUG]   Imported: org.eclipse.aether.repository < plexus.core
[DEBUG]   Imported: org.eclipse.aether.resolution < plexus.core
[DEBUG]   Imported: javax.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.settings < plexus.core
[DEBUG]   Imported: org.codehaus.classworlds < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
[DEBUG]   Imported: org.eclipse.aether.spi < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG]   Imported: org.apache.maven.configuration < plexus.core
[DEBUG]   Imported: org.apache.maven.cli < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.context < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG]   Imported: org.apache.maven.project < plexus.core
[DEBUG]   Imported: org.eclipse.aether.installation < plexus.core
[DEBUG]   Imported: org.eclipse.aether.deployment < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG]   Imported: org.apache.maven.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.model < plexus.core
[DEBUG]   Imported: org.slf4j.* < plexus.core
[DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.* < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.* < plexus.core
[DEBUG]   Imported: org.apache.maven.plugin < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG] Populating class realm maven.api
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=102, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=57, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=17, ConflictResolver.conflictItemCount=97, DefaultDependencyCollector.collectTime=512, DefaultDependencyCollector.transformTime=21}
[DEBUG] com.spotify:docker-maven-plugin:jar:0.0.23:
[DEBUG]    com.spotify:docker-client:jar:2.6.4:compile
[DEBUG]       org.slf4j:slf4j-api:jar:1.7.6:compile
[DEBUG]       com.google.guava:guava:jar:12.0.1:compile
[DEBUG]          com.google.code.findbugs:jsr305:jar:1.3.9:compile
[DEBUG]       org.apache.commons:commons-compress:jar:1.8.1:compile
[DEBUG]       org.apache.httpcomponents:httpclient:jar:4.3.5:compile
[DEBUG]          org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[DEBUG]          commons-logging:commons-logging:jar:1.1.3:compile
[DEBUG]          commons-codec:commons-codec:jar:1.6:compile
[DEBUG]       de.gesellix:unix-socket-factory:jar:2014-09-26T18-52-33:compile
[DEBUG]          org.codehaus.groovy:groovy-all:jar:2.3.6:runtime
[DEBUG]          org.codehaus.groovy.modules.http-builder:http-builder:jar:0.7.1:runtime
[DEBUG]             net.sf.json-lib:json-lib:jar:jdk15:2.3:runtime
[DEBUG]                commons-beanutils:commons-beanutils:jar:1.8.0:runtime
[DEBUG]                commons-collections:commons-collections:jar:3.2.1:runtime
[DEBUG]                commons-lang:commons-lang:jar:2.4:runtime
[DEBUG]                net.sf.ezmorph:ezmorph:jar:1.0.6:runtime
[DEBUG]             net.sourceforge.nekohtml:nekohtml:jar:1.9.16:runtime
[DEBUG]                xerces:xercesImpl:jar:2.9.1:runtime
[DEBUG]                   xml-apis:xml-apis:jar:1.3.04:runtime
[DEBUG]             xml-resolver:xml-resolver:jar:1.2:runtime
[DEBUG]       org.bouncycastle:bcpkix-jdk15on:jar:1.51:compile
[DEBUG]          org.bouncycastle:bcprov-jdk15on:jar:1.51:compile
[DEBUG]    com.typesafe:config:jar:1.2.0:compile
[DEBUG]    org.apache.maven:maven-core:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-model:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-settings:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-settings-builder:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-plugin-api:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-model-builder:jar:3.2.1:compile
[DEBUG]       org.apache.maven:maven-aether-provider:jar:3.2.1:compile
[DEBUG]          org.eclipse.aether:aether-spi:jar:0.9.0.M2:compile
[DEBUG]       org.eclipse.aether:aether-impl:jar:0.9.0.M2:compile
[DEBUG]       org.eclipse.aether:aether-api:jar:0.9.0.M2:compile
[DEBUG]       org.eclipse.aether:aether-util:jar:0.9.0.M2:compile
[DEBUG]       org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M5:compile
[DEBUG]          javax.enterprise:cdi-api:jar:1.0:compile
[DEBUG]             javax.annotation:jsr250-api:jar:1.0:compile
[DEBUG]             javax.inject:javax.inject:jar:1:compile
[DEBUG]          org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile
[DEBUG]             aopalliance:aopalliance:jar:1.0:compile
[DEBUG]          org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.0.0.M5:compile
[DEBUG]       org.codehaus.plexus:plexus-interpolation:jar:1.19:compile
[DEBUG]       org.codehaus.plexus:plexus-utils:jar:3.0.17:compile
[DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.5.1:compile
[DEBUG]       org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
[DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
[DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:3.2.1:compile
[DEBUG]    org.eclipse.jgit:org.eclipse.jgit:jar:3.2.0.201312181205-r:compile
[DEBUG]       com.jcraft:jsch:jar:0.1.46:compile
[DEBUG]       com.googlecode.javaewah:JavaEWAH:jar:0.5.6:compile
[DEBUG]    com.fasterxml.jackson.core:jackson-databind:jar:2.2.3:compile
[DEBUG]       com.fasterxml.jackson.core:jackson-annotations:jar:2.2.3:compile
[DEBUG]       com.fasterxml.jackson.core:jackson-core:jar:2.2.3:compile
[DEBUG] Created new class realm plugin>com.spotify:docker-maven-plugin:0.0.23
[DEBUG] Importing foreign packages into class realm plugin>com.spotify:docker-maven-plugin:0.0.23
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>com.spotify:docker-maven-plugin:0.0.23
[DEBUG]   Included: com.spotify:docker-maven-plugin:jar:0.0.23
[DEBUG]   Included: com.spotify:docker-client:jar:2.6.4
[DEBUG]   Included: org.slf4j:slf4j-api:jar:1.7.6
[DEBUG]   Included: com.google.guava:guava:jar:12.0.1
[DEBUG]   Included: com.google.code.findbugs:jsr305:jar:1.3.9
[DEBUG]   Included: org.apache.commons:commons-compress:jar:1.8.1
[DEBUG]   Included: org.apache.httpcomponents:httpclient:jar:4.3.5
[DEBUG]   Included: org.apache.httpcomponents:httpcore:jar:4.3.2
[DEBUG]   Included: commons-logging:commons-logging:jar:1.1.3
[DEBUG]   Included: commons-codec:commons-codec:jar:1.6
[DEBUG]   Included: de.gesellix:unix-socket-factory:jar:2014-09-26T18-52-33
[DEBUG]   Included: org.codehaus.groovy:groovy-all:jar:2.3.6
[DEBUG]   Included: org.codehaus.groovy.modules.http-builder:http-builder:jar:0.7.1
[DEBUG]   Included: net.sf.json-lib:json-lib:jar:jdk15:2.3
[DEBUG]   Included: commons-beanutils:commons-beanutils:jar:1.8.0
[DEBUG]   Included: commons-collections:commons-collections:jar:3.2.1
[DEBUG]   Included: commons-lang:commons-lang:jar:2.4
[DEBUG]   Included: net.sf.ezmorph:ezmorph:jar:1.0.6
[DEBUG]   Included: net.sourceforge.nekohtml:nekohtml:jar:1.9.16
[DEBUG]   Included: xerces:xercesImpl:jar:2.9.1
[DEBUG]   Included: xml-apis:xml-apis:jar:1.3.04
[DEBUG]   Included: xml-resolver:xml-resolver:jar:1.2
[DEBUG]   Included: org.bouncycastle:bcpkix-jdk15on:jar:1.51
[DEBUG]   Included: org.bouncycastle:bcprov-jdk15on:jar:1.51
[DEBUG]   Included: com.typesafe:config:jar:1.2.0
[DEBUG]   Included: org.eclipse.aether:aether-util:jar:0.9.0.M2
[DEBUG]   Included: javax.enterprise:cdi-api:jar:1.0
[DEBUG]   Included: javax.annotation:jsr250-api:jar:1.0
[DEBUG]   Included: javax.inject:javax.inject:jar:1
[DEBUG]   Included: org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0
[DEBUG]   Included: aopalliance:aopalliance:jar:1.0
[DEBUG]   Included: org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.0.0.M5
[DEBUG]   Included: org.codehaus.plexus:plexus-interpolation:jar:1.19
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:3.0.17
[DEBUG]   Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG]   Included: org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3
[DEBUG]   Included: org.sonatype.plexus:plexus-cipher:jar:1.4
[DEBUG]   Included: org.eclipse.jgit:org.eclipse.jgit:jar:3.2.0.201312181205-r
[DEBUG]   Included: com.jcraft:jsch:jar:0.1.46
[DEBUG]   Included: com.googlecode.javaewah:JavaEWAH:jar:0.5.6
[DEBUG]   Included: com.fasterxml.jackson.core:jackson-databind:jar:2.2.3
[DEBUG]   Included: com.fasterxml.jackson.core:jackson-annotations:jar:2.2.3
[DEBUG]   Included: com.fasterxml.jackson.core:jackson-core:jar:2.2.3
[DEBUG]   Excluded: org.apache.maven:maven-core:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-model:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-settings:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-settings-builder:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-model-builder:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-aether-provider:jar:3.2.1
[DEBUG]   Excluded: org.eclipse.aether:aether-spi:jar:0.9.0.M2
[DEBUG]   Excluded: org.eclipse.aether:aether-impl:jar:0.9.0.M2
[DEBUG]   Excluded: org.eclipse.aether:aether-api:jar:0.9.0.M2
[DEBUG]   Excluded: org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M5
[DEBUG]   Excluded: org.codehaus.plexus:plexus-classworlds:jar:2.5.1
[DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:3.2.1
[DEBUG] Configuring mojo com.spotify:docker-maven-plugin:0.0.23:push from plugin realm ClassRealm[plugin>com.spotify:docker-maven-plugin:0.0.23, parent: sun.misc.Launcher$AppClassLoader@77fe0d66]
[DEBUG] Configuring mojo 'com.spotify:docker-maven-plugin:0.0.23:push' with basic configurator -->
[DEBUG]   (f) imageName = mattijsf/docker-test-project
[DEBUG]   (f) execution = com.spotify:docker-maven-plugin:0.0.23:push {execution: default-cli}
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@44951097
[DEBUG] -- end configuration --
[INFO] Pushing mattijsf/docker-test-project
The push refers to a repository [mattijsf/docker-test-project] (len: 1)
Sending image list
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.451 s
[INFO] Finished at: 2014-11-09T14:52:49+01:00
[INFO] Final Memory: 17M/156M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.0.23:push (default-cli) on project docker-test-project: Exception caught: Error: Status 401 trying to push repository mattijsf/docker-test-project: "" -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.0.23:push (default-cli) on project docker-test-project: Exception caught
  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:108)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
  at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
  at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
  at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
  at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
  at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
  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: Exception caught
  at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:63)
  at com.spotify.docker.PushMojo.execute(PushMojo.java:38)
  at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
  ... 19 more
Caused by: com.spotify.docker.client.DockerException: Error: Status 401 trying to push repository mattijsf/docker-test-project: ""
  at com.spotify.docker.client.AnsiProgressHandler.progress(AnsiProgressHandler.java:55)
  at com.spotify.docker.client.ProgressStream.tail(ProgressStream.java:78)
  at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:561)
  at com.spotify.docker.Utils.pushImage(Utils.java:59)
  at com.spotify.docker.PushMojo.execute(PushMojo.java:47)
  at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:61)
  ... 22 more
[ERROR] 
[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
bash-4.3$ 

When I use the command docker push mattijsf/docker-test-project it is successfully able to upload the image. I also tried to run docker login again but I didn't have any impact.

Just as a sidenote I also saw this exact same error before updating to the latest docker / boot2docker for which HTTPS/TLS is "required". So I don't expect that this is related.

Since 401 is unauthorized I was wondering if I am missing a way to provide the credentials to the docker-maven-plugin... ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.