Giter Club home page Giter Club logo

dockerfile-maven's Introduction

Dockerfile Maven

Build Status Maven Central License

Status: mature

At this point, we're not developing or accepting new features or even fixing non-critical bugs.

This Maven plugin integrates Maven with Docker.

The design goals are:

  • Don't do anything fancy. Dockerfiles are how you build Docker projects; that's what this plugin uses. They are mandatory.
  • Make the Docker build process integrate with the Maven build process. If you bind the default phases, when you type mvn package, you get a Docker image. When you type mvn deploy, your image gets pushed.
  • Make the goals remember what you are doing. You can type mvn dockerfile:build and later mvn dockerfile:tag and later mvn dockerfile:push without problems. This also eliminates the need for something like mvn dockerfile:build -DalsoPush; instead you can just say mvn dockerfile:build dockerfile:push.
  • Integrate with the Maven build reactor. You can depend on the Docker image of one project in another project, and Maven will build the projects in the correct order. This is useful when you want to run integration tests involving multiple services.

This project adheres to the Open Code of Conduct. By participating, you are expected to honor this code.

See the changelog for a list of releases

Set-up

This plugin requires Java 7 or later and Apache Maven 3 or later (dockerfile-maven-plugin <=1.4.6 needs Maven >= 3, and for other cases, Maven >= 3.5.2). To run the integration tests or to use the plugin in practice, a working Docker set-up is needed.

Example

For more examples, see the integration test directory.

In particular, the advanced test showcases a full service consisting of two micro-services that are integration tested using helios-testing.

This configures the actual plugin to build your image with mvn package and push it with mvn deploy. Of course you can also say mvn dockerfile:build explicitly.

<plugin>
  <groupId>com.spotify</groupId>
  <artifactId>dockerfile-maven-plugin</artifactId>
  <version>${dockerfile-maven-version}</version>
  <executions>
    <execution>
      <id>default</id>
      <goals>
        <goal>build</goal>
        <goal>push</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <repository>spotify/foobar</repository>
    <tag>${project.version}</tag>
    <buildArgs>
      <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
    </buildArgs>
  </configuration>
</plugin>

A corresponding Dockerfile could look like:

FROM openjdk:8-jre
MAINTAINER David Flemström <[email protected]>

ENTRYPOINT ["/usr/bin/java", "-jar", "/usr/share/myservice/myservice.jar"]

# Add Maven dependencies (not shaded into the artifact; Docker-cached)
ADD target/lib           /usr/share/myservice/lib
# Add the service itself
ARG JAR_FILE
ADD target/${JAR_FILE} /usr/share/myservice/myservice.jar

Important note

The most Maven-ish way to reference the build artifact would probably be to use the project.build.directory variable for referencing the 'target'-directory. However, this results in an absolute path, which is not supported by the ADD command in the Dockerfile. Any such source must be inside the context of the Docker build and therefor must be referenced by a relative path. See #101

Do not use ${project.build.directory} as a way to reference your build directory.

What does it give me?

There are many advantages to using this plugin for your builds.

Faster build times

This plugin lets you leverage Docker cache more consistently, vastly speeding up your builds by letting you cache Maven dependencies in your image. It also encourages avoiding the maven-shade-plugin, which also greatly speeds up builds.

Consistent build lifecycle

You no longer have to say something like:

mvn package
mvn dockerfile:build
mvn verify
mvn dockerfile:push
mvn deploy

Instead, it is simply enough to say:

mvn deploy

With the basic configuration, this will make sure that the image is built and pushed at the correct times.

Depend on Docker images of other services

You can depend on the Docker information of another project, because this plugin attaches project metadata when it builds Docker images. Simply add this information to any project:

<dependency>
  <groupId>com.spotify</groupId>
  <artifactId>foobar</artifactId>
  <version>1.0-SNAPSHOT</version>
  <type>docker-info</type>
</dependency>

Now, you can read information about the Docker image of the project that you depended on:

String imageName = getResource("META-INF/docker/com.spotify/foobar/image-name");

This is great for an integration test where you want the latest version of another project's Docker image.

Note that you have to register a Maven extension in your POM (or a parent POM) in order for the docker-info type to be supported:

<build>
  <extensions>
    <extension>
      <groupId>com.spotify</groupId>
      <artifactId>dockerfile-maven-extension</artifactId>
      <version>${version}</version>
    </extension>
  </extensions>
</build>

Use other Docker tools that rely on Dockerfiles

Your project(s) look like so:

a/
  Dockerfile
  pom.xml
b/
  Dockerfile
  pom.xml

You can now use these projects with Fig or docker-compose or some other system that works with Dockerfiles. For example, a docker-compose.yml might look like:

service-a:
  build: a/
  ports:
  - '80'

service-b:
  build: b/
  links:
  - service-a

Now, docker-compose up and docker-compose build will work as expected.

Usage

See usage docs.

Authentication

See authentication docs.

Releasing

To cut the Maven release:

mvn clean [-B -Dinvoker.skip -DskipTests -Darguments='-Dinvoker.skip -DskipTests'] \
  -Dgpg.keyname=<key ID used for signing artifacts> \
  release:clean release:prepare release:perform

We use gren to create Releases in Github:

gren release

dockerfile-maven's People

Contributors

andreysaksonov avatar boskoop avatar chabala avatar chipkillmar avatar davidxia avatar dflemstr avatar freesoft avatar glindstedt avatar javierjeronimo avatar joeyb avatar lasselindqvist avatar matthyx avatar mattnworb avatar mavenraven avatar mmaeller avatar pinguet62 avatar pirayya avatar rlodge avatar rouzwawi avatar seamonstr avatar taer 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

dockerfile-maven's Issues

Upgrading to version 17.06.0-ce-win18 of Docker for Windows breaks build

Since upgrading to versions 17.06.0-ce-win18 of Docker for Windows I get the following stacktrace.

[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not build image
at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:164)
at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:95)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:219)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:208)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
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:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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:498)
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: com.spotify.docker.client.exceptions.DockerException: com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.spotify.docker.client.messages.RegistryAuth: no String-argument constructor/factory method to deserialize from String value ('wincred')
at [Source: N/A; line: -1, column: -1] (through reference chain: java.util.LinkedHashMap["credsStore"])
at com.spotify.docker.client.auth.ConfigFileRegistryAuthSupplier.authForBuild(ConfigFileRegistryAuthSupplier.java:96)
at com.spotify.docker.client.auth.MultiRegistryAuthSupplier.authForBuild(MultiRegistryAuthSupplier.java:77)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1371)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1348)
at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:157)
... 25 more
Caused by: com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.spotify.docker.client.messages.RegistryAuth: no String-argument constructor/factory method to deserialize from String value ('wincred')
at [Source: N/A; line: -1, column: -1] (through reference chain: java.util.LinkedHashMap["credsStore"])
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1456)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1012)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.ValueInstantiator._createFromStringFallbacks(ValueInstantiator.java:370)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromString(StdValueInstantiator.java:315)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromString(BeanDeserializerBase.java:1283)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:159)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:150)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:517)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:362)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:27)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1187)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:314)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3770)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2099)
at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.ObjectMapper.treeToValue(ObjectMapper.java:2596)
at com.spotify.docker.client.DockerConfigReader.parseDockerConfig(DockerConfigReader.java:94)
at com.spotify.docker.client.DockerConfigReader.fromConfig(DockerConfigReader.java:48)
at com.spotify.docker.client.auth.ConfigFileRegistryAuthSupplier.authForBuild(ConfigFileRegistryAuthSupplier.java:94)
... 29 more

Build failure (mvn package) due to missing target file.

Hello,

I have com.spotify:dockerfifle-maven-plugin:1.3.0 to build a docker container for this spring-boot app.

On mvn package, I get error indicating jar file is missing.

mvn package
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building spring-boot-embedded-tomcat 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-boot-embedded-tomcat ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ spring-boot-embedded-tomcat ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Users/sdas1/OneDrive/computer/next/depot/github/spring-boot-embedded-tomcat/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ spring-boot-embedded-tomcat ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/sdas1/OneDrive/computer/next/depot/github/spring-boot-embedded-tomcat/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ spring-boot-embedded-tomcat ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ spring-boot-embedded-tomcat ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ spring-boot-embedded-tomcat ---
[INFO] Building jar: /Users/sdas1/OneDrive/computer/next/depot/github/spring-boot-embedded-tomcat/target/spring-boot-embedded-tomcat-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.3.RELEASE:repackage (default) @ spring-boot-embedded-tomcat ---
[INFO] 
[INFO] --- dockerfile-maven-plugin:1.3.0:build (default) @ spring-boot-embedded-tomcat ---
[INFO] Building Docker context /Users/sdas1/OneDrive/computer/next/depot/github/spring-boot-embedded-tomcat/docker
[INFO] 
[INFO] Image will be built as com-san/spring-boot-embedded-tomcat:0.0.1-SNAPSHOT
[INFO] 
[INFO] Step 1/5 : FROM frolvlad/alpine-oraclejdk8:slim
[INFO] Pulling from frolvlad/alpine-oraclejdk8
[INFO] Digest: sha256:49772b54d8ed36e060d3e20b704d586a1292b243054c968a494b0c3079605ba5
[INFO] Status: Image is up to date for frolvlad/alpine-oraclejdk8:slim
[INFO]  ---> 354831d86a05
[INFO] Step 2/5 : ENV SERVER_PORT 38080
[INFO]  ---> Using cache
[INFO]  ---> ac6e30c94cb5
[INFO] Step 3/5 : EXPOSE $SERVER_PORT
[INFO]  ---> Using cache
[INFO]  ---> 0ade83cbc7ca
[INFO] Step 4/5 : COPY target/spring-boot-embedded-tomcat-0.0.1-SNAPSHOT.jar /
[ERROR] lstat target/spring-boot-embedded-tomcat-0.0.1-SNAPSHOT.jar: no such file or directory
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.414 s
[INFO] Finished at: 2017-06-07T14:07:29-07:00
[INFO] Final Memory: 43M/738M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.0:build (default) on project spring-boot-embedded-tomcat: Could not build image: lstat target/spring-boot-embedded-tomcat-0.0.1-SNAPSHOT.jar: no such file or directory -> [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

Project structure

.
./docker
./docker/docker-compose.yml
./docker/Dockerfile
./pom.xml
./README.md
./spring-boot-embedded-tomcat.iml
./src
./src/main
./src/main/java
./src/main/java/com
./src/main/java/com/spring
./src/main/java/com/spring/boot
./src/main/java/com/spring/boot/app
./src/main/java/com/spring/boot/app/SampleApplication.java
./src/main/java/com/spring/boot/controller
./src/main/java/com/spring/boot/controller/SampleController.java
./src/main/java/com/spring/boot/model
./src/main/java/com/spring/boot/model/SampleRequest.java
./src/main/java/com/spring/boot/model/SampleResponse.java
./src/main/resources
./src/main/resources/application.properties

build plugin inside pom.xml

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.5.3.RELEASE</version>
        </plugin>
        <plugin>
            <groupId>com.spotify</groupId>
            <artifactId>dockerfile-maven-plugin</artifactId>
            <version>1.3.0</version>
            <executions>
                <execution>
                    <id>default</id>
                    <goals>
                        <goal>build</goal>
                        <goal>push</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <repository>com-san/spring-boot-embedded-tomcat</repository>
                <tag>${project.version}</tag>
                <contextDirectory>docker</contextDirectory>
                <retryCount>0</retryCount>
            </configuration>
        </plugin>
    </plugins>
</build>

Dockerfile

FROM frolvlad/alpine-oraclejdk8:slim

ENV SERVER_PORT 38080
EXPOSE $SERVER_PORT

COPY target/spring-boot-embedded-tomcat-0.0.1-SNAPSHOT.jar /

CMD [ "java", "-jar", "/spring-boot-embedded-tomcat-0.0.1-SNAPSHOT.jar" ]

Project code - https://github.com/mesanjeeb/spring-boot-embedded-tomcat/tree/spotify-dockerfile-plugin

Thanks,
San

NullpointerException after Docker upgrade

Hi,

Just after upgrading Docker Community Edition on OSX (Sierra 10.12.5) to Version 17.06.0-ce-mac18 (18433) Channel: stable d9b66511e0 I got this NullPointerException when building my project.

Any ideas how I can fix this?

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.5", arch: "x86_64", family: "mac"
...
[INFO] --- dockerfile-maven-plugin:1.3.0:build (default) @ myproject ---
[DEBUG] Using mirror dvp-nexus (http://dvprepo.dvg.local/dvpnexus/content/groups/public) for jcenter (http://jcenter.bintray.com).
[DEBUG] Using mirror dvp-nexus (http://dvprepo.dvg.local/dvpnexus/content/groups/public) for jvnet-nexus-releases (https://maven.java.net/content/repositories/releases/).
[DEBUG] Using mirror dvp-nexus (http://dvprepo.dvg.local/dvpnexus/content/groups/public) for jvnet-nexus-snapshots (https://maven.java.net/content/repositories/snapshots).
[DEBUG] Using mirror dvp-nexus (http://dvprepo.dvg.local/dvpnexus/content/groups/public) for spring-external (http://repository.springsource.com/maven/bundles/external).
[DEBUG] Using mirror dvp-nexus (http://dvprepo.dvg.local/dvpnexus/content/groups/public) for glassfish-repo-archive (http://maven.glassfish.org/content/groups/glassfish).
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=1, ConflictMarker.nodeCount=256, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=95, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=5, ConflictResolver.conflictItemCount=187, DefaultDependencyCollector.collectTime=451, DefaultDependencyCollector.transformTime=6}
[DEBUG] com.spotify:dockerfile-maven-plugin:jar:1.3.0:
[DEBUG]    com.spotify:docker-client:jar:shaded:8.7.1:compile
[DEBUG]       org.slf4j:slf4j-api:jar:1.7.22:compile
[DEBUG]       com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.8.8:compile
[DEBUG]          com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.8.8:compile
[DEBUG]          com.fasterxml.jackson.core:jackson-core:jar:2.8.8:compile
[DEBUG]          com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.8:compile
[DEBUG]       com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.8.8:compile
[DEBUG]       com.fasterxml.jackson.core:jackson-databind:jar:2.8.8:compile
[DEBUG]          com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[DEBUG]       org.glassfish.jersey.core:jersey-client:jar:2.22.2:compile
[DEBUG]          javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[DEBUG]          org.glassfish.jersey.core:jersey-common:jar:2.22.2:compile
[DEBUG]             javax.annotation:javax.annotation-api:jar:1.2:compile
[DEBUG]             org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.22.2:compile
[DEBUG]             org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[DEBUG]          org.glassfish.hk2:hk2-api:jar:2.4.0-b34:compile
[DEBUG]             org.glassfish.hk2:hk2-utils:jar:2.4.0-b34:compile
[DEBUG]             org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b34:compile
[DEBUG]          org.glassfish.hk2.external:javax.inject:jar:2.4.0-b34:compile
[DEBUG]          org.glassfish.hk2:hk2-locator:jar:2.4.0-b34:compile
[DEBUG]             org.javassist:javassist:jar:3.18.1-GA:compile
[DEBUG]       org.glassfish.jersey.connectors:jersey-apache-connector:jar:2.22.2:compile
[DEBUG]       org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.22.2:compile
[DEBUG]          org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.22.2:compile
[DEBUG]       org.apache.commons:commons-compress:jar:1.9:compile
[DEBUG]       commons-io:commons-io:jar:2.5:compile
[DEBUG]       org.apache.httpcomponents:httpclient:jar:4.5:compile
[DEBUG]          commons-logging:commons-logging:jar:1.2:compile
[DEBUG]          commons-codec:commons-codec:jar:1.9:compile
[DEBUG]       org.apache.httpcomponents:httpcore:jar:4.4.5:compile
[DEBUG]       com.github.jnr:jnr-unixsocket:jar:0.8:compile
[DEBUG]          com.github.jnr:jnr-ffi:jar:2.0.3:compile
[DEBUG]             com.github.jnr:jffi:jar:1.2.9:compile
[DEBUG]             com.github.jnr:jffi:jar:native:1.2.9:runtime
[DEBUG]             org.ow2.asm:asm:jar:5.0.3:compile
[DEBUG]             org.ow2.asm:asm-commons:jar:5.0.3:compile
[DEBUG]             org.ow2.asm:asm-analysis:jar:5.0.3:compile
[DEBUG]             org.ow2.asm:asm-tree:jar:5.0.3:compile
[DEBUG]             org.ow2.asm:asm-util:jar:5.0.3:compile
[DEBUG]             com.github.jnr:jnr-x86asm:jar:1.0.2:compile
[DEBUG]          com.github.jnr:jnr-constants:jar:0.8.7:compile
[DEBUG]          com.github.jnr:jnr-enxio:jar:0.9:compile
[DEBUG]          com.github.jnr:jnr-posix:jar:3.0.12:compile
[DEBUG]       commons-lang:commons-lang:jar:2.6:compile
[DEBUG]       org.bouncycastle:bcpkix-jdk15on:jar:1.52:compile
[DEBUG]          org.bouncycastle:bcprov-jdk15on:jar:1.52:compile
[DEBUG]       ch.qos.logback:logback-classic:jar:1.2.1:compile
[DEBUG]          ch.qos.logback:logback-core:jar:1.2.1:compile
[DEBUG]    com.google.auth:google-auth-library-oauth2-http:jar:0.6.0:compile
[DEBUG]       com.google.auth:google-auth-library-credentials:jar:0.6.0:compile
[DEBUG]       com.google.http-client:google-http-client:jar:1.19.0:compile
[DEBUG]          com.google.code.findbugs:jsr305:jar:2.0.1:compile
[DEBUG]       com.google.http-client:google-http-client-jackson2:jar:1.19.0:compile
[DEBUG]    com.google.guava:guava:jar:19.0:compile
[DEBUG]    com.spotify:dockerfile-maven-extension:jar:1.3.0:compile
[DEBUG]    org.apache.maven:maven-plugin-api:jar:3.3.9:compile
[DEBUG]       org.apache.maven:maven-model:jar:3.3.9:compile
[DEBUG]       org.apache.maven:maven-artifact:jar:3.3.9:compile
[DEBUG]       org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.2:compile
[DEBUG]          javax.enterprise:cdi-api:jar:1.0:compile
[DEBUG]             javax.annotation:jsr250-api:jar:1.0:compile
[DEBUG]          org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.2:compile
[DEBUG]    org.apache.maven:maven-core:jar:3.3.9:compile
[DEBUG]       org.apache.maven:maven-settings:jar:3.3.9:compile
[DEBUG]       org.apache.maven:maven-settings-builder:jar:3.3.9:compile
[DEBUG]          org.apache.maven:maven-builder-support:jar:3.3.9:compile
[DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.3.9:compile
[DEBUG]       org.apache.maven:maven-model-builder:jar:3.3.9:compile
[DEBUG]       org.apache.maven:maven-aether-provider:jar:3.3.9:compile
[DEBUG]          org.eclipse.aether:aether-spi:jar:1.0.2.v20150114:compile
[DEBUG]       org.eclipse.aether:aether-impl:jar:1.0.2.v20150114:compile
[DEBUG]       org.eclipse.aether:aether-api:jar:1.0.2.v20150114:compile
[DEBUG]       org.eclipse.aether:aether-util:jar:1.0.2.v20150114:compile
[DEBUG]       com.google.inject:guice:jar:no_aop:4.0:compile
[DEBUG]          javax.inject:javax.inject:jar:1:compile
[DEBUG]          aopalliance:aopalliance:jar:1.0:compile
[DEBUG]       org.codehaus.plexus:plexus-interpolation:jar:1.21:compile
[DEBUG]       org.codehaus.plexus:plexus-utils:jar:3.0.22:compile
[DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.5.2:compile
[DEBUG]       org.codehaus.plexus:plexus-component-annotations:jar:1.6: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.commons:commons-lang3:jar:3.4:compile
[DEBUG]    org.apache.maven:maven-archiver:jar:3.0.0:compile
[DEBUG]       org.apache.maven.shared:maven-shared-utils:jar:3.0.0:compile
[DEBUG]       org.codehaus.plexus:plexus-archiver:jar:2.9.1:compile
[DEBUG]          org.codehaus.plexus:plexus-io:jar:2.4.1:compile
[DEBUG] Created new class realm plugin>com.spotify:dockerfile-maven-plugin:1.3.0
[DEBUG] Importing foreign packages into class realm plugin>com.spotify:dockerfile-maven-plugin:1.3.0
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>com.spotify:dockerfile-maven-plugin:1.3.0
[DEBUG]   Included: com.spotify:dockerfile-maven-plugin:jar:1.3.0
[DEBUG]   Included: com.spotify:docker-client:jar:shaded:8.7.1
[DEBUG]   Included: com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.8.8
[DEBUG]   Included: com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.8.8
[DEBUG]   Included: com.fasterxml.jackson.core:jackson-core:jar:2.8.8
[DEBUG]   Included: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.8
[DEBUG]   Included: com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.8.8
[DEBUG]   Included: com.fasterxml.jackson.core:jackson-databind:jar:2.8.8
[DEBUG]   Included: com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0
[DEBUG]   Included: org.glassfish.jersey.core:jersey-client:jar:2.22.2
[DEBUG]   Included: javax.ws.rs:javax.ws.rs-api:jar:2.0.1
[DEBUG]   Included: org.glassfish.jersey.core:jersey-common:jar:2.22.2
[DEBUG]   Included: javax.annotation:javax.annotation-api:jar:1.2
[DEBUG]   Included: org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.22.2
[DEBUG]   Included: org.glassfish.hk2:osgi-resource-locator:jar:1.0.1
[DEBUG]   Included: org.glassfish.hk2:hk2-api:jar:2.4.0-b34
[DEBUG]   Included: org.glassfish.hk2:hk2-utils:jar:2.4.0-b34
[DEBUG]   Included: org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b34
[DEBUG]   Included: org.glassfish.hk2.external:javax.inject:jar:2.4.0-b34
[DEBUG]   Included: org.glassfish.hk2:hk2-locator:jar:2.4.0-b34
[DEBUG]   Included: org.javassist:javassist:jar:3.18.1-GA
[DEBUG]   Included: org.glassfish.jersey.connectors:jersey-apache-connector:jar:2.22.2
[DEBUG]   Included: org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.22.2
[DEBUG]   Included: org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.22.2
[DEBUG]   Included: org.apache.commons:commons-compress:jar:1.9
[DEBUG]   Included: commons-io:commons-io:jar:2.5
[DEBUG]   Included: org.apache.httpcomponents:httpclient:jar:4.5
[DEBUG]   Included: commons-logging:commons-logging:jar:1.2
[DEBUG]   Included: commons-codec:commons-codec:jar:1.9
[DEBUG]   Included: org.apache.httpcomponents:httpcore:jar:4.4.5
[DEBUG]   Included: com.github.jnr:jnr-unixsocket:jar:0.8
[DEBUG]   Included: com.github.jnr:jnr-ffi:jar:2.0.3
[DEBUG]   Included: com.github.jnr:jffi:jar:1.2.9
[DEBUG]   Included: com.github.jnr:jffi:jar:native:1.2.9
[DEBUG]   Included: org.ow2.asm:asm:jar:5.0.3
[DEBUG]   Included: org.ow2.asm:asm-commons:jar:5.0.3
[DEBUG]   Included: org.ow2.asm:asm-analysis:jar:5.0.3
[DEBUG]   Included: org.ow2.asm:asm-tree:jar:5.0.3
[DEBUG]   Included: org.ow2.asm:asm-util:jar:5.0.3
[DEBUG]   Included: com.github.jnr:jnr-x86asm:jar:1.0.2
[DEBUG]   Included: com.github.jnr:jnr-constants:jar:0.8.7
[DEBUG]   Included: com.github.jnr:jnr-enxio:jar:0.9
[DEBUG]   Included: com.github.jnr:jnr-posix:jar:3.0.12
[DEBUG]   Included: commons-lang:commons-lang:jar:2.6
[DEBUG]   Included: org.bouncycastle:bcpkix-jdk15on:jar:1.52
[DEBUG]   Included: org.bouncycastle:bcprov-jdk15on:jar:1.52
[DEBUG]   Included: ch.qos.logback:logback-classic:jar:1.2.1
[DEBUG]   Included: ch.qos.logback:logback-core:jar:1.2.1
[DEBUG]   Included: com.google.auth:google-auth-library-oauth2-http:jar:0.6.0
[DEBUG]   Included: com.google.auth:google-auth-library-credentials:jar:0.6.0
[DEBUG]   Included: com.google.http-client:google-http-client:jar:1.19.0
[DEBUG]   Included: com.google.code.findbugs:jsr305:jar:2.0.1
[DEBUG]   Included: com.google.http-client:google-http-client-jackson2:jar:1.19.0
[DEBUG]   Included: com.google.guava:guava:jar:19.0
[DEBUG]   Included: com.spotify:dockerfile-maven-extension:jar:1.3.0
[DEBUG]   Included: javax.enterprise:cdi-api:jar:1.0
[DEBUG]   Included: javax.annotation:jsr250-api:jar:1.0
[DEBUG]   Included: org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.2
[DEBUG]   Included: org.apache.maven:maven-builder-support:jar:3.3.9
[DEBUG]   Included: org.eclipse.aether:aether-util:jar:1.0.2.v20150114
[DEBUG]   Included: com.google.inject:guice:jar:no_aop:4.0
[DEBUG]   Included: aopalliance:aopalliance:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-interpolation:jar:1.21
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:3.0.22
[DEBUG]   Included: org.codehaus.plexus:plexus-component-annotations:jar:1.6
[DEBUG]   Included: org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3
[DEBUG]   Included: org.sonatype.plexus:plexus-cipher:jar:1.4
[DEBUG]   Included: org.apache.commons:commons-lang3:jar:3.4
[DEBUG]   Included: org.apache.maven:maven-archiver:jar:3.0.0
[DEBUG]   Included: org.apache.maven.shared:maven-shared-utils:jar:3.0.0
[DEBUG]   Included: org.codehaus.plexus:plexus-archiver:jar:2.9.1
[DEBUG]   Included: org.codehaus.plexus:plexus-io:jar:2.4.1
[DEBUG] Configuring mojo com.spotify:dockerfile-maven-plugin:1.3.0:build from plugin realm ClassRealm[plugin>com.spotify:dockerfile-maven-plugin:1.3.0, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
[DEBUG] Configuring mojo 'com.spotify:dockerfile-maven-plugin:1.3.0:build' with basic configurator -->
[DEBUG]   (f) buildDirectory = /Users/myuser/Documents/Private/JavaProjects/myproject/target
[DEBUG]   (f) classifier = docker-info
[DEBUG]   (f) connectTimeoutMillis = 300000
[DEBUG]   (f) contextDirectory = /Users/myuser/Documents/Private/JavaProjects/myproject
[DEBUG]   (f) dockerInfoDirectory = /Users/myuser/Documents/Private/JavaProjects/myproject/target/docker
[DEBUG]   (f) finalName = myproject
[DEBUG]   (f) forceCreation = false
[DEBUG]   (f) noCache = false
[DEBUG]   (f) project = MavenProject: nl.bitrade:myproject:1.0.0.3-SNAPSHOT @ /Users/myuser/Documents/Private/JavaProjects/myproject/pom.xml
[DEBUG]   (f) pullNewerImage = true
[DEBUG]   (f) readTimeoutMillis = 300000
[DEBUG]   (f) repository = 805657053710.dkr.ecr.eu-west-1.amazonaws.com/myproject
[DEBUG]   (f) retryCount = 1
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@1c65121
[DEBUG]   (f) skip = false
[DEBUG]   (f) skipBuild = false
[DEBUG]   (f) tag = 1.0.0.3-SNAPSHOT
[DEBUG]   (f) testOutputDirectory = /Users/myuser/Documents/Private/JavaProjects/myproject/target/test-classes
[DEBUG]   (f) verbose = false
[DEBUG]   (f) writeTestMetadata = true
[DEBUG] -- end configuration --
[DEBUG] Using configfile: /Users/myuser/.docker/config.json
[DEBUG] Failed to load Google application default credentials
java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
	at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:111)
	at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:103)
	at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:76)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.googleContainerRegistryAuthSupplier(AbstractDockerMojo.java:448)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.createRegistryAuthSupplier(AbstractDockerMojo.java:405)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.openDockerClient(AbstractDockerMojo.java:386)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:219)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:208)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	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:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	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:147)
[DEBUG] /Users/myuser/.docker/ca.pem, /Users/myuser/.docker/key.pem or /Users/myuser/.docker/cert.pem does not exist, not using SSL
[INFO] Building Docker context /Users/myuser/Documents/Private/JavaProjects/myproject
[INFO] 
[INFO] Image will be built as xxxxxxxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/myproject:1.0.0.3-SNAPSHOT
[INFO] 
[INFO] Step 1/10 : FROM java:8
[INFO] Pulling from library/java
[INFO] Digest: sha256:c1ff613e8ba25833d2e1940da0940c3824f03f802c449f3d1815a66b7f8c0e9d
[INFO] Status: Image is up to date for java:8
[INFO]  ---> d23bdf5b1b1b
[INFO] Step 2/10 : LABEL vendor "MyProject"
[INFO]  ---> Using cache
[INFO]  ---> 7bfdfcaddae9
[INFO] Step 3/10 : EXPOSE 8080
[INFO]  ---> Using cache
[INFO]  ---> a75973c4f510
[INFO] Step 4/10 : HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1
[INFO]  ---> Using cache
[INFO]  ---> 1af7c702980e
[INFO] Step 5/10 : ENV JAVA_TOOL_OPTIONS -Dfile.encoding=UTF-8
[INFO]  ---> Using cache
[INFO]  ---> ed92aa96b020
[INFO] Step 6/10 : VOLUME /tmp
[INFO]  ---> Using cache
[INFO]  ---> db50832836e7
[INFO] Step 7/10 : ADD target/myproject.jar /myproject.jar
[INFO]  ---> 92f84b9dbbba
[INFO] Removing intermediate container 862187e75fb8
[INFO] Step 8/10 : RUN bash -c 'touch /myproject.jar'
[INFO]  ---> Running in 9ed3f720bf56
[INFO]  ---> a0fe406755eb
[INFO] Removing intermediate container 9ed3f720bf56
[INFO] Step 9/10 : RUN apt-get update && apt-get install -y         curl
[INFO]  ---> Running in be0ad24735ed
[INFO] Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
[INFO] Get:2 http://security.debian.org jessie/updates/main amd64 Packages [524 kB]
[INFO] Ign http://deb.debian.org jessie InRelease
[INFO] Get:3 http://deb.debian.org jessie-updates InRelease [145 kB]
[INFO] Get:4 http://deb.debian.org jessie-backports InRelease [166 kB]
[INFO] Get:5 http://deb.debian.org jessie Release.gpg [2373 B]
[INFO] Get:6 http://deb.debian.org jessie Release [148 kB]
[INFO] Get:7 http://deb.debian.org jessie-updates/main amd64 Packages [17.8 kB]
[INFO] Get:8 http://deb.debian.org jessie-backports/main amd64 Packages [1175 kB]
[INFO] Get:9 http://deb.debian.org jessie/main amd64 Packages [9065 kB]
[INFO] Fetched 11.3 MB in 10s (1071 kB/s)
[INFO] Reading package lists...
[INFO] 
[INFO] Reading package lists...
[INFO] 
[INFO] Building dependency tree...
[INFO] 
[INFO] Reading state information...
[INFO] 
[INFO] curl is already the newest version.
[INFO] 0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.
[INFO]  ---> 3c391e69b61e
[INFO] Removing intermediate container be0ad24735ed
[INFO] Step 10/10 : ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -jar /myproject.jar
[INFO]  ---> Running in f3f49ebf6af6
[INFO]  ---> 47bb7473eead
[INFO] Removing intermediate container f3f49ebf6af6
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
...
[INFO] MyProject .......................................... FAILURE [ 27.876 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.078 s
[INFO] Finished at: 2017-06-29T18:26:57+02:00
[INFO] Final Memory: 62M/511M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.0:build (default) on project myproject: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.0:build (default) on project myproject: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	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:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	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:147)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 26 more
Caused by: java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:212)
	at com.google.common.base.Splitter.split(Splitter.java:407)
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleGeneric(LoggingProgressHandler.java:83)
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:67)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1389)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1348)
	at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:157)
	at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:95)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:219)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:208)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 27 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/PluginExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :myproject

Could not build image: java.io.IOException: request to write '8192' bytes exceeds size...

Hi,

We are investigating the build of Docker images inside of Docker and are stuck by an IOException.
The project is a simple Spring Boot hello-world (equivalent of the ones found on their site) with a really straightforward Dockerfile. It builds perfectly on my local host (ubuntu 16.04, openjdk-8, docker 1.12) but fails as soon as it builds inside a Docker container (dind). However, building the app (mvn clean package) and docker image (docker build -t ...) separately in the dind does work.

You will find the error log as well as the Dockefile of the dind/java container below.

Have you ever experienced this issue? Could you help us understand this behavior?

Many thanks in advance,
Thomas

Maven build log:

org.apache.maven.plugin.MojoExecutionException: Could not build image
        at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:164)
        at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:95)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:219)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:208)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        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:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        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:498)
        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: java.io.IOException: request to write '8192' bytes exceeds size in header of '12960433' bytes for entry 'docker-client-7093082277195045664.tar.gz'
        at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.write(TarArchiveOutputStream.java:377)
        at java.nio.file.Files.copy(Files.java:2909)
        at java.nio.file.Files.copy(Files.java:3069)
        at com.spotify.docker.client.CompressedDirectory$Visitor.visitFile(CompressedDirectory.java:302)
        at com.spotify.docker.client.CompressedDirectory$Visitor.visitFile(CompressedDirectory.java:252)
        at java.nio.file.Files.walkFileTree(Files.java:2670)
        at com.spotify.docker.client.CompressedDirectory.create(CompressedDirectory.java:114)
        at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1373)
        at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1348)
        at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:157)
        ... 25 more
        Suppressed: java.io.IOException: This archives contains unclosed entries.
                at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.finish(TarArchiveOutputStream.java:220)
                at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.close(TarArchiveOutputStream.java:236)
                at com.spotify.docker.client.CompressedDirectory.create(CompressedDirectory.java:119)
                ... 28 more

Dockerfile dind/java:

FROM docker:stable-dind
ENV LANG C.UTF-8

RUN { \
        echo '#!/bin/sh'; \
        echo 'set -e'; \
        echo; \
        echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
    } > /usr/local/bin/docker-java-home \
    && chmod +x /usr/local/bin/docker-java-home
ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin

ENV JAVA_VERSION 8u121
ENV JAVA_ALPINE_VERSION 8.121.13-r0

RUN set -x \
    && apk add --no-cache \
        openjdk8="$JAVA_ALPINE_VERSION" \
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]

Can't push to artifactory

I can't push my image up to artifactory even though it works with a manual docker push

I know similar issues have been reported with the config.json and OSX.

Can you please release 1.3.6 so I can use maven settings.xml instead via your new <useMavenSettingsForAuth> tag?

Thanks!

An HTTPS URI for DOCKER_HOST must be provided to use Docker client certificates

Hi.

We tried to move from 'docker-maven-plugin' to this one. But we can't build the image on 'OS X El Captain"

For the examples below we are always running

mvn clean verify -P docker

Our first two attempts were with

export DOCKER_HOST=tcp://localhost:2375

and

export DOCKER_HOST=https://localhost:2375

which yielded

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.3:build (default) on project my-api: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused -> [Help 1]

Then we tried

export DOCKER_HOST=unix:///var/run/docker.sock

which gave us

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.3:build (default) on project my-api: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.3:build failed: An HTTPS URI for DOCKER_HOST must be provided to use Docker client certificates -> [Help 1]

We can't find any docs on how to get it working.

My pom.xml for reference

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>my.package</groupId>
        <artifactId>myapp</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>myapi</artifactId>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <scala.version>2.12.2</scala.version>
        <scala-maven-plugin.version>3.2.2</scala-maven-plugin.version>
        <logback.version>1.2.3</logback.version>
        <akka.version>10.0.9</akka.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-http_2.12</artifactId>
            <version>${akka.version}</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-http-spray-json_2.12</artifactId>
            <version>${akka.version}</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.scala-logging</groupId>
            <artifactId>scala-logging_2.12</artifactId>
            <version>3.7.1</version>
        </dependency>
        <dependency>
            <groupId>net.logstash.logback</groupId>
            <artifactId>logstash-logback-encoder</artifactId>
            <version>4.11</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>${scala-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                    <scalaCompatVersion>2.12</scalaCompatVersion>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml
                    </dependencyReducedPomLocation>
                    <transformers>
                        <transformer
                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <mainClass>my.package.MainApi</mainClass>
                        </transformer>
                        <transformer
                                implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                            <resource>reference.conf</resource>
                        </transformer>
                    </transformers>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>docker</id>
            <build>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                    </resource>
                    <resource>
                        <directory>${project.basedir}/docker</directory>
                        <targetPath>${project.build.directory}</targetPath>
                        <includes>
                            <include>Dockerfile</include>
                        </includes>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>com.spotify</groupId>
                        <artifactId>dockerfile-maven-plugin</artifactId>
                        <version>1.3.3</version>
                        <executions>
                            <execution>
                                <id>default</id>
                                <goals>
                                    <goal>build</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

Allow docker authentication from maven settings

It would be convenient to allow docker authentication using the regular server configuration in the maven settings.xml file. This would make the builds more portable, allow easier setup on build servers etc. which already have these settings configured, and would also avoid conflicts with changes in the docker configuration (my mac's docker daemon keeps removing my auth settings and storing them in "osxkeychain", so every day I have to re-add the settings correctly.
I propose adding a new property to the configuration:

<useMavenSettingsForAuth>true</useMavenSettingsForAuth>

Which will add a new provider for the authorization.

NPE when building under Docker Edge for Mac

Under the latest version of Docker Edge for Mac:

$ docker version
Client:
 Version:      17.06.0-ce-rc4
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   29fcd5d
 Built:        Thu Jun 15 17:29:01 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.06.0-ce-rc4
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   29fcd5dfae
 Built:        Thu Jun 15 18:50:07 2017
 OS/Arch:      linux/amd64
 Experimental: true

A simple build (https://github.com/bradbeck/dockerfile-maven) fails consistently with a NullPointerException:

$ mvn install
...
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.0:build (default) on project dockerfile-maven: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed.: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.0:build (default) on project dockerfile-maven: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	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:498)
	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.PluginExecutionException: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	... 20 more
Caused by: java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:212)
	at com.google.common.base.Splitter.split(Splitter.java:407)
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleGeneric(LoggingProgressHandler.java:83)
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:67)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1389)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1348)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1341)
	at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:161)
	at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:95)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:219)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:208)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 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/PluginExecutionException

Error building image

Environemnt
Docker for Mac, v 17.0.3.1
Maven, v 3.5.0
Java, v 1.8.0_131

pom.xml,

<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
  <execution>
     <id>default</id>
                        <goals>
                            <goal>build</goal>
                            <goal>push</goal>
                        </goals>
                    </execution>
                </executions>
<configuration>
                    <contextDirectory>${project.basedir}</contextDirectory>
                    <writeTestMetadata>false</writeTestMetadata>
                    <dockerInfoDirectory>${project.basedir}</dockerInfoDirectory>
                    <verbose>true</verbose>
                    <forceCreation>true</forceCreation>
                    <repository>xxxxxxx/${project.name}</repository>
                    <tag>${project.version}</tag>
                    <pullNewerImage>false</pullNewerImage>
</configuration>

Building the image from the console using,

docker -D build -t xxxxx:1.x.x-SNAPSHOT . --> OK

mvn -X dockerfile:build --> ERROR

com.spotify.docker.client.exceptions.DockerRequestException: Request error: POST unix://localhost:80/build?t=xxx%3A1.x.x-SNAPSHOT: 500, body: {"message":"Cannot locate specified Dockerfile: Dockerfile"}

	at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:2387)
	at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2337)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1376)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1348)
	at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:157)
	... 25 more

i think it is the same issue as this one,
spotify/docker-client#479
but setting the $DOCKER_HOST environment variable to unix:///var/run/docker.sock does not fix the problem,

ran the following command,

curl -v --unix-socket /var/run/docker.sock http:/_ping
* Unwillingly accepted illegal URL using 1 slash!
* Rebuilt URL to: http://_ping/
*   Trying /var/run/docker.sock...
* Connected to _ping (/Users/xxxxxx/Library/Containers/com.doc) port 80 (#0)
> GET / HTTP/1.1
> Host: _ping
> User-Agent: curl/7.51.0
> Accept: */*
> 
< HTTP/1.1 404 Not Found
< Content-Length: 29
< Content-Type: application/json
< Date: Wed, 14 Jun 2017 05:15:21 GMT
< 
{"message":"page not found"}
* Curl_http_done: called premature == 0
* Connection #0 to host _ping left intact

but ran this other one
curl --unix-socket /var/run/docker.sock "http:/v1.24/_ping" --> OK
Any idea on how to fix the issue?

Support for private docker registry?

Hi,

I would like to know if this plugin officially supports pulling from a private docker registry?

I get authentication issue when I try to pull from an image from a private docker registry.

Thanks

error when copy directory

Hi all,
seems dockerfile-maven can't hanle COPY statement correctly, when the COPY src is a directory, it will encounter error that:

Could not copy files: /home/jenkins/workspace/deploy_owl_dashboard_local/UI/target/docker/html (Is a directory

Dockerfile


FROM docker.io/nginx:latest

MAINTAINER [email protected]


COPY default.conf /etc/nginx/conf.d/default.conf.templ
COPY conf-builder.sh /usr/bin/conf-builder.sh
COPY html /usr/share/nginx/html
RUN chmod +x /usr/bin/conf-builder.sh


EXPOSE 80 443

CMD conf-builder.sh &&\
  nginx -g "daemon off;"

maven errors:

[INFO] Building Docker context /home/jenkins/workspace/deploy_owl_dashboard_local/UI/target/docker
[INFO]
[INFO] Image will be built as xxxxx
[INFO]
[INFO] Step 1 : FROM docker.io/nginx:latest
[INFO] Pulling from library/nginx
[INFO] Digest: sha256:b644a3bdb2888d53c0d0c24aafe06ad8c88936ca5e127088a7a5686a54ea0713
[INFO] Status: Image is up to date for nginx:latest
[INFO]  ---> 66216d141be6
[INFO] Step 2 : MAINTAINER xxx
[INFO]  ---> Using cache
[INFO]  ---> 1e318e2f3309
[INFO] Step 3 : COPY default.conf /etc/nginx/conf.d/default.conf.templ
[INFO]  ---> Using cache
[INFO]  ---> 92076a0110ab
[INFO] Step 4 : COPY conf-builder.sh /usr/bin/conf-builder.sh
[INFO]  ---> Using cache
[INFO]  ---> e0590a8bba04
[INFO] Step 5 : COPY html /usr/share/nginx/html
[INFO]  ---> Using cache
[INFO]  ---> 36361d53a7de
[INFO] Step 6 : RUN chmod +x /usr/bin/conf-builder.sh
[INFO]  ---> Using cache
[INFO]  ---> 4a68a1c99a9e
[INFO] Step 7 : EXPOSE 80 443
[INFO]  ---> Using cache
[INFO]  ---> 62154791d60e
[INFO] Step 8 : CMD conf-builder.sh &&  nginx -g "daemon off;"
[INFO]  ---> Using cache
[INFO]  ---> 144d90b3062e
[INFO] Successfully built 144d90b3062e
[INFO]
[INFO] Detected build of image with id 144d90b3062e
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 49.740 s
[INFO] Finished at: 2017-09-12T03:04:00+00:00
[INFO] Final Memory: 45M/946M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.5:build (package) on project UI: Could not copy files: /home/jenkins/workspace/deploy_owl_dashboard_local/UI/target/docker/html (Is a directory) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.5:build (package) on project UI: Could not copy files
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        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:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        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:498)
        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: Could not copy files
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.writeTestMetadata(AbstractDockerMojo.java:286)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.writeMetadata(AbstractDockerMojo.java:246)
        at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:121)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:227)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:216)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.io.FileNotFoundException: /home/jenkins/workspace/deploy_owl_dashboard_local/UI/target/docker/html (Is a directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at com.google.common.io.Files$FileByteSource.openStream(Files.java:126)
        at com.google.common.io.Files$FileByteSource.openStream(Files.java:116)
        at com.google.common.io.ByteSource.copyTo(ByteSource.java:267)
        at com.google.common.io.Files.copy(Files.java:315)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.writeTestMetadata(AbstractDockerMojo.java:284)
        ... 26 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

Plugin does not work with custom Docker credHelpers.

I need to push docker images into Amazon EC2 Container repo and since the plugin does not support it I am using "credHelpers" in config.json along with https://github.com/awslabs/amazon-ecr-credential-helper.
Command line "docker push imagename" works without requiring login and any authentication errors. But when using with plugin I am getting this exception:

org.apache.maven.plugin.MojoExecutionException: Could not push image at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:90) at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:227) at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:216) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 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:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 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:498) 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: com.spotify.docker.client.exceptions.DockerException: no basic auth credentials at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError(LoggingProgressHandler.java:105) at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:63) at com.spotify.docker.client.ProgressStream.tail(ProgressStream.java:74) at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:1291) at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:1271) at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:88)

Seems like the plugin is not including "credHelpers" when serializing config.json.

Build docker FROM local image

I have created several DockerFiles in a hiearchy of dependencies resulting in some of my DockerFile has a FROM from other Docker images on my pc.

Using vanilla I can do FROM my-first-dockerfile in my second DockerFile without a registry prefix. Docker looks for local images before trying to downloading it from public registries.

https://stackoverflow.com/questions/20481225/how-can-i-use-a-local-image-as-the-base-image-with-a-dockerfile#20501690

But dockerfile-maven-plugin seems to skip the step of looking locally I get "repository my-first-dockerfile not found: does not exist or no pull access".

I have worked around this by running a local registry using https://hub.docker.com/_/registry/ and change my FROMs to FROM localhost:5000/my-first-dockerfile

But is a way to make dockerfile-maven-plugin/dockerclient follow default behaviour?

Cannot build docker image when the base image is not in docker.io

I try to build an image that extends from another imagine only available in local cache. The other imagine is not in docker hub. The plugin doesn't seem to be able find the local cache and try to retrieve from docker.io.

docker images show me

REPOSITORY                             TAG                    IMAGE ID
ixxus/alfresco-repository              5.1                    768225554bf7        3 days ago
[INFO] Building Docker context /Users/alu/Workspace/projects/ixxus/alfresco/repo-cms
[INFO]
[INFO] Image will be built as ixxus/new-image:spotify-plugin
[INFO]
[INFO] Step 1 : FROM ixxus/alfresco-repository:5.1
[INFO] Pulling repository docker.io/ixxus/alfresco-repository
[ERROR] Error: image ixxus/alfresco-repository:5.1 not found
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not build image
        at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:150)
        at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:87)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:206)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:195)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        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:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        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:498)
        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: com.spotify.docker.client.exceptions.DockerException: Error: image ixxus/alfresco-repository:5.1 not found
        at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError(LoggingProgressHandler.java:106)
        at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:64)
        at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1162)
        at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1111)
        at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:143)
        ... 25 more

Support for custom build args

The current plug-in doesn't seem to provide a capability to provide custom build args into the build image task.

I have a scenario where a version parameter is passed into my dockerfile via a buildarg.

As the docker-client already supports passing in a buildparam list (that's how nocache, etc. works) is this something that would be logical to add to the plug-in?

Would a PR supporting this be accepted?

How to specify the image name?

In the old plugin (docker-maven-plugin) it was possible to specify the image name.

 <imageName>example</imageName>

Is there a way to do this with this plugin?

push multiple tags

Hi,

Is it possible to add new function to push multiple tags?
I saw docker-maven-plugin is already with this function.
Always we may need to push image with two tags, one is with version like 1.0.0, and another one is latest.
Thanks!

unable to push to docker hub from plugin although i can push using docker push

I have the following configuration in pom.xml

 <build>
    <plugins>
        <plugin>
            <groupId>com.spotify</groupId>
            <artifactId>dockerfile-maven-plugin</artifactId>
            <version>1.3.4</version>
            <executions>
          <execution>
            <id>build</id>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
          <execution>
            <id>tag</id>
            <goals>
              <goal>tag</goal>
            </goals>
            <configuration>
              <repository>DOCKER_HUB_ACCOUNT/euraka-service</repository>x
            </configuration>
          </execution>
        </executions>
        </plugin>
    </plugins>
</build>

when i : sudo run mvn clean package , everything is ok
but when i run : sudo mvn dockerfile:push

i get the following error:

[INFO] --- dockerfile-maven-plugin:1.3.4:push (default-cli) @ eureka-service ---
[INFO] The push refers to a repository [docker.io/DOCKER_HUB_ACCOUNT/euraka-service]
[INFO] Image 9f41bdcbb175: Preparing
[INFO] Image a77c3bad0c4f: Preparing
[INFO] Image 8ed4ebdc2a2b: Preparing
[INFO] Image 2fd640341bb9: Preparing
[INFO] Image 5bef08742407: Preparing
[ERROR] denied: requested access to the resource is denied
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not push image
at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:90)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:227)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:216)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
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:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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:498)
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: com.spotify.docker.client.exceptions.DockerException: denied: requested access to the resource is denied

when i run : sudo docker push DOCKER_HUB_ACCOUNT/euraka-service
the image is push to docker hub successfully
this happens whether the repo is public or private

Build fails on windows 10 with Illegal char <*> at index 0: **\\*

Running mvn -X install against my example project results in the following stack trace:

[DEBUG] Auth Config null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.261 s
[INFO] Finished at: 2017-06-03T18:09:35-04:00
[INFO] Final Memory: 15M/249M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.2.2:build (default-cli) on project docker-foo-service: Execution default-cli of goal com.spotify:dockerfi
le-maven-plugin:1.2.2:build failed: Illegal char <*> at index 0: **\\* -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.2.2:build (default-cli) on project docker-foo-service: Ex
ecution default-cli of goal com.spotify:dockerfile-maven-plugin:1.2.2:build failed: Illegal char <*> at index 0: **\\*
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        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:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        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:498)
        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.PluginExecutionException: Execution default-cli of goal com.spotify:dockerfile-maven-plugin:1.2.2:build failed: Illegal char <*> at index 0
: **\\*
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.nio.file.InvalidPathException: Illegal char <*> at index 0: **\\*
        at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
        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 sun.nio.fs.AbstractPath.startsWith(AbstractPath.java:43)
        at com.spotify.docker.client.CompressedDirectory$DockerIgnorePathMatcher.matches(CompressedDirectory.java:402)
        at com.spotify.docker.client.CompressedDirectory$Visitor.exclude(CompressedDirectory.java:291)
        at com.spotify.docker.client.CompressedDirectory$Visitor.visitFile(CompressedDirectory.java:268)
        at com.spotify.docker.client.CompressedDirectory$Visitor.visitFile(CompressedDirectory.java:248)
        at java.nio.file.Files.walkFileTree(Files.java:2670)
        at com.spotify.docker.client.CompressedDirectory.create(CompressedDirectory.java:110)
        at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1146)
        at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1111)
        at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:152)
        at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:91)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:206)
        at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:195)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 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/PluginExecutionException

Java version:

PS C:\Users\ltheisen\git\pastdev-docker-foo-service> java -version
openjdk version "1.8.0_131-1-redhat"
OpenJDK Runtime Environment (build 1.8.0_131-1-redhat-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

Maven version:

PS C:\Users\ltheisen\git\pastdev-docker-foo-service> mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Maven home: C:\Users\ltheisen\Tools\apache-maven-3.3.9
Java version: 1.8.0_131-1-redhat, vendor: Oracle Corporation
Java home: C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.131-1\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

Run on Windows 10 Pro using powershell:

PS C:\Users\ltheisen\git\pastdev-docker-foo-service> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      15063  296

Plugin broken after upgrade to Docker 17.06-ce

After upgrading to Docker from 17.05 to 17.06, none of my Maven modules running the dockerfile-maven-plugin work.

I have tried on two different boxes, one running Maven 3.3.3 and the other 3.5.0.

I presume there has been a API change in Docker with this release that is causing the problem.

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.0:build (default) on project config-manager-container: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed. NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.0:build (default) on project config-manager-container: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) 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:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) 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:498) 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.PluginExecutionException: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20 more Caused by: java.lang.NullPointerException at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:212) at com.google.common.base.Splitter.split(Splitter.java:407) at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleGeneric(LoggingProgressHandler.java:83) at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:67) at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1389) at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1348) at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:157) at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:95) at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:219) at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:208) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 21 more

"Manifest not found" when using a local base

I have a project using a base image (via FROM line) which is only available locally. docker build works fine when invoked directly.

When building with Maven, the build fails with "Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.5:build (default) on project {{ my project }}: Could not build image: manifest for {{ my project }} not found -> [Help 1]"

It seems dockerfile-maven is reaching out to the public registry, rather than using the locally available image. Is there a way to force the java client to use local images?

checkstyle fails on generated-sources when releasing the project

adding a note so I don't forget, but when releasing this project, checkstyle seems to be reporting on warnings in the generated Mojo classes, and then failing the build:

[INFO] --- maven-checkstyle-plugin:2.17:check (validate) @ dockerfile-maven-plugin ---
[INFO] Starting audit...
[WARN] /Users/mattbrown/code/dockerfile-maven/plugin/target/generated-sources/plugin/com/spotify/plugin/dockerfile/HelpMojo.java:15: Wrong order for 'javax.xml.parsers.DocumentBuilder' import. [ImportOrder]
...
[WARNING] target/generated-sources/plugin/com/spotify/plugin/dockerfile/HelpMojo.java:[453] (indentation) Indentation: 'method def rcurly' have incorrect indentation level 4, expected level should be 2.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Dockerfile Maven Support ........................... SUCCESS [ 17.660 s]
[INFO] Dockerfile Maven Extension ......................... SUCCESS [  2.535 s]
[INFO] Dockerfile Maven Plugin ............................ FAILURE [ 13.927 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.051 s
[INFO] Finished at: 2017-06-05T17:40:09-04:00
[INFO] Final Memory: 59M/759M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project dockerfile-maven-plugin: You have 392 Checkstyle violations. -> [Help 1]

Support Docker external credential stores

Hi

As of Docker 1.11 (via PR 20107), external credentials stores for registries are now supported.

e.g. in ~/.docker/config.json:

{
    "auths": {
        "localhost:5001": {}
    },
    "credsStore": "wincred"
}

However in latest dockerfile-maven-plugin, this seems not to be supported with lots of errors like:
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.0:build (default) on project MY-PROJECT: Could not build image: Error: BASE-IMAGE:latest not found

On further inspection is seems unable to support (or in fact understand) the externalised credentials referred to in the config, instead parsing it as empty credentials, and then failing to log in to the private repo.

I guess the first improvement would be to recognise these newer configurations and fail / warn about them not being supported; even better would be to be able to use them, though I imagine this is quite hard.

Thanks!

docker-info.jar will be uploaded twice

I'm trying to switch our maven docker project from the old to the new plugin and I'm getting an error because our repo setup does not allow that the same artifact will be overwritten.
I can see that the same jar will be uploaded twice in the maven output:

13:23:48 [INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ docker-jdk8 ---
13:23:48 [INFO] Downloading: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/maven-metadata.xml
13:23:49 [INFO] Uploading: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/docker-jdk8-1.0.1-20170519.112348-1.pom
13:23:49 [INFO] Uploaded: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/docker-jdk8-1.0.1-20170519.112348-1.pom (4 KB at 50.0 KB/sec)
13:23:49 [INFO] Downloading: <REPO_PATH>/de/edict/docker/docker-jdk8/maven-metadata.xml
13:23:49 [INFO] Uploading: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/maven-metadata.xml
13:23:49 [INFO] Uploaded: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/maven-metadata.xml (603 B at 73.6 KB/sec)
13:23:49 [INFO] Uploading: <REPO_PATH>/de/edict/docker/docker-jdk8/maven-metadata.xml
13:23:49 [INFO] Uploaded: <REPO_PATH>/de/edict/docker/docker-jdk8/maven-metadata.xml (286 B at 7.5 KB/sec)
13:23:49 [INFO] Uploading: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/docker-jdk8-1.0.1-20170519.112348-1-docker-build-info.jar
13:23:49 [INFO] Uploaded: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/docker-jdk8-1.0.1-20170519.112348-1-docker-build-info.jar (4 KB at 47.3 KB/sec)
13:23:49 [INFO] Uploading: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/maven-metadata.xml
13:23:49 [INFO] Uploaded: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/maven-metadata.xml (827 B at 101.0 KB/sec)
13:23:49 [INFO] Uploading: <REPO_PATH>/de/edict/docker/docker-jdk8/1.0.1-SNAPSHOT/docker-jdk8-1.0.1-20170519.112348-1-docker-build-info.jar

The pom setup:

<plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>1.2.2</version>
                <configuration>
                    <contextDirectory>${project.basedir}/src/main/docker</contextDirectory>
                    <repository>${docker-image.name}</repository>
                    <tag>latest</tag>
                    <classifier>docker-build-info</classifier>
                </configuration>
                <executions>
                    <execution>
                        <id>build</id>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>tag</id>
                        <goals>
                            <goal>tag</goal>
                        </goals>
                        <configuration>
                            <repository>${docker.registry.url}/${docker-image.name}</repository>
                            <tag>${docker-image.version}</tag>
                        </configuration>
                    </execution>
                    <execution>
                        <id>push</id>
                        <goals>
                            <goal>push</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Pushing to Docker Hub doesn't work

How to reproduce:

  • Log into dockerhub: docker login docker.io
  • /.docker/config.json now looks like this:
    { "auths": { "https://index.docker.io/v1/": { "auth": "..." } } }
  • When doing mvn dockerfile:push, I get a com.spotify.docker.client.exceptions.DockerException: denied: requested access to the resource is denied

Workaround:

  • Modify /.docker/config.json, so the auths entry named https://index.docker.io/v1/ is replaced with docker.io, like this:
    { "auths": { "docker.io": { "auth": "..." } } }

Full stack trace:

[INFO] The push refers to a repository [docker.io/schneiderelectricitb/appbackend]
...
[ERROR] denied: requested access to the resource is denied
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not push image
	at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:90)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:219)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:208)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	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: com.spotify.docker.client.exceptions.DockerException: denied: requested access to the resource is denied
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError(LoggingProgressHandler.java:105)
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:63)
	at com.spotify.docker.client.ProgressStream.tail(ProgressStream.java:74)
	at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:1274)
	at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:1252)
	at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:88)
	... 23 more

Getting maven build fail with 1.3.0 version

Hello, I'm getting this error with 1.3.0 version, but no problem with 1.2.2. Is it known issue or something I need to change my configuration?

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.0:build (default) on project server: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.0:build failed: Plugin com.spotify:dockerfile-maven-plugin:1.3.0 or one of its dependencies could not be resolved: Could not find artifact com.spotify:docker-client:jar:shaded:8.7.1 in repo (OUR INTERNAL REPO that MIRRORS public one) -> [Help 1]

NullPointerException in LoggingProgressHandler

I'm trying to use the dockerfile-maven plugin, but I haven't been able to get even the smallest example to work. Here's my Dockerfile:

FROM ubuntu:latest
CMD ["ls"]

Here's my pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>simple-docker</artifactId>
    <name>simple-docker</name>
    <groupId>com.example</groupId>
    <version>0.0.1</version>
    <build>
        <plugins>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>1.2.2</version>
                <executions>
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>build</goal>
                            <goal>push</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <repository>tmp/junk</repository>
                    <tag>latest</tag>
                </configuration>
          </plugin>
        </plugins>
    </build>
</project>

And here's my output:

$ mvn -e package
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-docker 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ simple-docker ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/tpanning/Projects/deft-docker/owf/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ simple-docker ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ simple-docker ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/tpanning/Projects/deft-docker/owf/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ simple-docker ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ simple-docker ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ simple-docker ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /home/tpanning/Projects/deft-docker/owf/target/simple-docker-0.0.1.jar
[INFO] 
[INFO] --- dockerfile-maven-plugin:1.2.2:build (default) @ simple-docker ---
[INFO] Building Docker context /home/tpanning/Projects/deft-docker/owf
[INFO] 
[INFO] Image will be built as tmp/junk:latest
[INFO] 
[INFO] Step 0 : FROM ubuntu:latest
[INFO] Trying to pull repository docker.io/library/ubuntu ... 
[INFO] Pulling from library/ubuntu
[INFO] Image 576b12d1aa01: Already exists
[INFO] Image b5ce920a148c: Already exists
[INFO] Image 274da7f89b05: Already exists
[INFO] Image 0346cecb4e51: Already exists
[INFO] Image 2e36b30057ab: Already exists
[INFO] Image f5bb94a8fac4: Already exists
[INFO] Digest: sha256:7c8894a0f32d3f1fadf086d18d12441ce0cd19295075af8dee34ce5e1f6c3ed1
[INFO] Status: Image is up to date for docker.io/ubuntu:latest
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.110 s
[INFO] Finished at: 2017-04-27T13:10:32-04:00
[INFO] Final Memory: 27M/202M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.2.2:build (default) on project simple-docker: Execution default of goal com.spotify:dockerfile-maven-plugin:1.2.2:build failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.2.2:build (default) on project simple-docker: Execution default of goal com.spotify:dockerfile-maven-plugin:1.2.2:build failed.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	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:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	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:498)
	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.PluginExecutionException: Execution default of goal com.spotify:dockerfile-maven-plugin:1.2.2:build failed.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:212)
	at com.google.common.base.Splitter.split(Splitter.java:407)
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleGeneric(LoggingProgressHandler.java:84)
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:68)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1162)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1111)
	at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:152)
	at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:91)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:206)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:195)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 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/PluginExecutionException

For reference, here's my version info:

$ mvn --version
Apache Maven 3.3.9 (NON-CANONICAL_2016-07-01T11:53:38Z_mockbuild; 2016-07-01T07:53:38-04:00)
Maven home: /usr/share/maven
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-1.b12.fc25.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.10.11-200.fc25.x86_64", arch: "amd64", family: "unix"
$ docker --version
Docker version 1.8.2.fc21, build 3abcea7-dirty

Am I missing or misconfiguring something?

How does dockerfile maven plugin respect .dockerignore?

I have a .dockerignore file that reads like this:

target
!target/lib
!target/*.jar

docker build ... respected it and was able to copy over everything in target/lib and target/*.jar, but ignore rest of the targets.

When using mvn dockerfile:build, it actually returned an error:

INFO] Digest: sha256:0eca986ed1177c8ec71d41248a10a21f23a4650a9e7237699da0fa75d67e126c
[INFO] Status: Image is up to date for openjdk:8
[INFO]  ---> 7df8b534906e
[INFO] Step 2/5 : COPY target/lib /app/lib
[ERROR] lstat target/lib: no such file or directory

Dockerhub private organization repo - no pull access

I'm having issues pulling images from a private dockerhub organization repo using the plugin

Pulling the image using docker pull works fine:

docker pull company/base-image:0.0.1

But running mvn install I get:

[ERROR] repository company/base-image not found: does not exist or no pull access

Any suggestions?

Google Container Registry: Unable to get access token (invalid_grant)

I'm having an issue getting this plugin to work with a repository hosted on Google Container Registry (GCR).

When trying to build using the following configuration (as adapted from the configuration in README), it appears that the plugin fails to retrieve a valid access token from Google:

          <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>1.3.5</version>
                <executions>
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>build</goal>
                            <!--<goal>push</goal>-->
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <repository>gcr.io/xxx/yyy</repository>
                    <tag>${project.version}</tag>
                </configuration>
            </plugin>
unable to get access token for Google Container Registry, configuration for building image will not contain RegistryAuth for GCR
com.google.api.client.http.HttpResponseException: 400 Bad Request
{
  "error" : "invalid_grant"
}

I'm not sure if I need any additional configuration but manually running gcloud docker -a works fine, so I would suspect that there's not an issue with my local setup:

$ gcloud docker -a
Short-lived access for ['gcr.io', 'us.gcr.io', 'eu.gcr.io', 'asia.gcr.io', 'l.gcr.io', 'launcher.gcr.io', 'us-mirror.gcr.io', 'eu-mirror.gcr.io', 'asia-mirror.gcr.io', 'mirror.gcr.io'] configured.

Once I've done that I can push to GCR just fine (using docker push), but the plugin does not seem to use this configuration, or at least not for this step so that doesn't help.

Anonymized logs below:

[INFO] --- dockerfile-maven-plugin:1.3.5:build (default-cli) @ xxx ---
10:16:40.958 [main] DEBUG com.spotify.docker.client.DockerConfigReader - Using configfile: /Users/bas/.docker/config.json
[INFO] Using Google application default credentials
10:16:41.153 [main] INFO com.spotify.docker.client.auth.gcr.ContainerRegistryAuthSupplier - loaded credentials for user account with clientId=32555940559.apps.googleusercontent.com
10:16:41.215 [main] DEBUG com.spotify.docker.client.DockerCertificates - /Users/bas/.docker/ca.pem, /Users/bas/.docker/key.pem or /Users/bas/.docker/cert.pem does not exist, not using SSL
[INFO] Building Docker context /Users/bas/xxx
[INFO] 
[INFO] Image will be built as gcr.io/xxx/yyy:1.0.1
[INFO] 
10:16:42.880 [main] WARN com.spotify.docker.client.auth.gcr.ContainerRegistryAuthSupplier - unable to get access token for Google Container Registry, configuration for building image will not contain RegistryAuth for GCR
com.google.api.client.http.HttpResponseException: 400 Bad Request
{
  "error" : "invalid_grant"
}
	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1054)
	at com.google.auth.oauth2.UserCredentials.refreshAccessToken(UserCredentials.java:207)
	at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:149)
	at com.spotify.docker.client.auth.gcr.ContainerRegistryAuthSupplier$DefaultCredentialRefresher.refresh(ContainerRegistryAuthSupplier.java:195)
	at com.spotify.docker.client.auth.gcr.ContainerRegistryAuthSupplier.getAccessToken(ContainerRegistryAuthSupplier.java:226)
	at com.spotify.docker.client.auth.gcr.ContainerRegistryAuthSupplier.authForBuild(ContainerRegistryAuthSupplier.java:295)
	at com.spotify.docker.client.auth.MultiRegistryAuthSupplier.authForBuild(MultiRegistryAuthSupplier.java:77)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1388)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1365)
	at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:178)
	at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:105)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:227)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:216)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	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: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: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)

Environment:

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /Applications/NetBeans/NetBeans 7.4.app/Contents/Resources/NetBeans/java/maven
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.4", arch: "x86_64", family: "mac"

no such file or directory

Hi I have mac pc,
I have com.spotify:dockerfifle-maven-plugin:1.3.3 to build a docker container for this spring-boot app.
I am receiving:
[INFO] Step 2/5 : ADD target/pharma-api.jar app.jar [ERROR] ADD failed: stat /var/lib/docker/tmp/docker-builder529138473/target/pharma-api.jar: no such file or directory

I don't know from where /var/lib/docker/tmp/docker-builder529138473/ it is coming,
and it is random

Pull from store/oracle/serverjre

I've added store/oracle/serverjre(https://store.docker.com/images/oracle-serverjre-8) to my personal catalog and it works perfectly on local machine using command line like below:
docker run --rm store/oracle/serverjre:8 java -version

However, when building maven project based from the image above with this plugin, it fails to pull store/oracle/serverjre image. Any suggestion?

[INFO] Step 1/6 : FROM store/oracle/serverjre:8
[ERROR] repository store/oracle/serverjre not found: does not exist or no pull access
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not build image
	at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:159)
	at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:91)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:206)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:195)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	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:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	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:498)
	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: com.spotify.docker.client.exceptions.DockerException: repository store/oracle/serverjre not found: does not exist or no pull access
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError(LoggingProgressHandler.java:106)
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:64)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1162)
	at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1111)
	at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:152)
	... 25 more

Could not find artifact com.spotify:dockerfile-maven-plugin:jar:1.7.3 in..

I am trying to use this plugin but it can not find jar file from the repository
may be something broken ?

Downloading: http://repo.spring.io/milestone/com/spotify/dockerfile-maven-plugin/1.7.3/dockerfile-maven-plugin-1.7.3.pom
Downloading: https://repo.maven.apache.org/maven2/com/spotify/dockerfile-maven-plugin/1.7.3/dockerfile-maven-plugin-1.7.3.pom
[WARNING] The POM for com.spotify:dockerfile-maven-plugin:jar:1.7.3 is missing, no dependency information available
Downloading: http://repo.spring.io/milestone/com/spotify/dockerfile-maven-plugin/1.7.3/dockerfile-maven-plugin-1.7.3.jar
Downloading: https://repo.maven.apache.org/maven2/com/spotify/dockerfile-maven-plugin/1.7.3/dockerfile-maven-plugin-1.7.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.015 s
[INFO] Finished at: 2017-08-14T10:38:40+03:00
[INFO] Final Memory: 16M/217M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin com.spotify:dockerfile-maven-plugin:1.7.3 or one of its dependencies could not be resolved: Could not find artifact com.spotify:dockerfile-maven-plugin:jar:1.7.3 in spring-milestones (http://repo.spring.io/milestone) -> [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/PluginResolutionException

Un-hardcode Google Repository in AbstractDockerMojo and add AWS ECR support

Hi,

I like your plugin very much but I use AWS ECR and AWS ECS and not Google Repository.

I would like to contribute with AWS ECR and AWS ECS functionality but AbstractDockerMojo seems to be hardcoded to support Google Repository only adding an extra would mesh up the code.

Wouldn't it be nice to extract the Google Repository code and then be able to plug in Google or AWS ECR?

If you extract Google Repository I'll contribute with a AWS ECR plugin following your design principles.

Docker authentication to private registry fails since 1.3.4

I have upgraded to 1.3.4 to benefit from the flag googleContainerRegistryEnabled, but I encounter the following exception:

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.4:push (push-docker-image) on project sample: Could not push image: no basic auth credentials -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.4:push (push-docker-image) on project sample: Could not push image
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	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:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:129)
	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:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
	at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:176)
	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:498)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:139)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
	at hudson.remoting.UserRequest.perform(UserRequest.java:153)
	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
	at hudson.remoting.Request$2.run(Request.java:336)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
	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:748)
Caused by: org.apache.maven.plugin.MojoExecutionException: Could not push image
	at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:90)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:227)
	at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:216)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 31 more
Caused by: com.spotify.docker.client.exceptions.DockerException: no basic auth credentials
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError(LoggingProgressHandler.java:105)
	at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:63)
	at com.spotify.docker.client.ProgressStream.tail(ProgressStream.java:74)
	at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:1291)
	at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:1271)
	at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:88)
	... 35 more

I have a quite standard config.json:

{
	"auths": {
		"nexus.localdomain:5000": {
			"auth": "hashedPwd"
		},
		"nexus.localdomain:5001": {
			"auth": "hashedPwd"
		}
	}
}

I have also tested with a duplicated one like below with and without protocols as I stumbled on old issues linked to that problem, but with no more success, idem with only protocol suffixed ones:

{
	"auths": {
		"http://nexus.localdomain:5000": {
			"auth": "hashedPwd"
		},
		"http://nexus.localdomain:5001": {
			"auth": "hashedPwd"
		},
		"nexus.localdomain:5000": {
			"auth": "hashedPwd"
		},
		"nexus.localdomain:5001": {
			"auth": "hashedPwd"
		}
	}
}

I thinks that it is linked to the upgrade of the Docker client from 8.8.0 to 8.8.1 introduced by c295836 to resolve #23. I suspect more specifically the commit spotify/docker-client@c29e44b.

Invalid RSA private key when using Docker client with maven dockerfile:build with Docker Data Center 17.06

Hello,

I am experiencing an "Invalid RSA Private Key" exception, coming from Spotify's underlying Docker Client when running mvn dockerfile:build against a remote Docker Data Center Cluster 17.06.

I have therefore opened an issue within the Docker client repo here as I think this location is more appropriate.

I would welcome if any people looking at this issue-tracker could also give me some help.

Many thanks.

NullPointer on mvn package

When using Eclipse and Maven on Windows 10 with Docker for Windows 17.06, dockerfile plugin 1.3.0 reports a null pointer exception. Any ideas? Or need more info?
stack.txt

Question: mvn package without building the Docker image

I would like to use a two step approach (as the old plugin worked):
(1) mvn package to only build my jar file without building the Docker image
(2) mvn dockerfile:build to build my Docker Image

Is there a way to modify the plugin (overwrite via pom.xml settings) that I can achieve this?

Thanks for any help.

Pass Maven properties as ENV values in Dockerfile

Hi,

I need to pass artifactId, groupId and other Maven properties as ENV values in the Dockerfile.

With Maven filtering I would expect the following to work after proper configuration of the Maven plugin:

ENV ARTIFACT_ID=@artifactId@ GROUP_ID=@groupId@

Would it be possible to add support for Maven filtering or is there another way I can achieve this?

As a work-around I suppose I could copy the docker file from somewhere to the project root with filtering enabled but this seems like a roundabout way to do it.

Docker build output is gone

The build output is now missing from the build step. I have already created a solution for it and could add a PR or just write the code right here.

The class is LoggingProgressHandler.java

  @Override
  public void progress(ProgressMessage message) throws DockerException {
    if (message.error() != null) {
      handleError(message.error());
    } else if (message.progressDetail() != null) {
      handleProgress(message.id(), message.status(), message.progress());
-   } else if (message.status() != null) {
+   } else if ((message.status() != null) || (message.stream() != null)) {
      handleGeneric(message.stream(), message.status());
    }

    String imageId = message.buildImageId();
    if (imageId != null) {
      builtImageId = imageId;
    }
  }

Without build output:

[INFO] --- dockerfile-maven-plugin:1.3.3:build (default) @ test-build ---
[INFO] Building Docker context /home/pirayya/test-project
[INFO]                                                                          
[INFO] Image will be built as test-project:0.0.1-SNAPSHOT
[INFO]                                                                                                                           
[INFO] Pulling from library/golang
[INFO] Digest: sha256:4a2e35d9f8259a33a2c7574ab2be062d793f2526ff65391b7e7b6f4677901b3f
[INFO] Status: Image is up to date for golang:1.8-alpine
[INFO]
[INFO] Detected build of image with id 66e15db7b0f2
[INFO] Building jar: /home/pirayya/test-project/target/test-project-0.0.1-SNAPSHOT-docker-info.jar
[INFO] Successfully built test-project:0.0.1-SNAPSHOT

With build output:

[INFO] --- dockerfile-maven-plugin:1.3.4-SNAPSHOT:build (default) @ a ---
[INFO] Building Docker context /home/pirayya/test-project        
[INFO]                                                                                                               
[INFO] Image will be built as test-project:0.0.1-SNAPSHOT
[INFO]                 
[INFO] Step 1/2 : FROM library/golang:1.8-alpine
[INFO] ---> 310e63753884
[INFO] Step 2/2 : MAINTAINER Pirayya
[INFO] ---> Running in 2015ad568fa1
[INFO] ---> f695cfc9b4b0
[INFO] Removing intermediate container 2015ad568fa1
[INFO] Successfully built f695cfc9b4b0
[INFO] Successfully tagged test-project:0.0.1-SNAPSHOT
[INFO] 
[INFO] Detected build of image with id 71e7424502a1
[INFO] Building jar: /home/pirayya/test-project/target/test-project-0.0.1-SNAPSHOT-docker-info.jar
[INFO] Successfully built test-project:0.0.1-SNAPSHOT

Release for version 1.3.6

Will there be a 1.3.6 release? The README states Since version 1.3.6, you can authenticate using your maven settings.xml instead of docker configuration. Just add configuration similar to:, but there is no release with this version yet.

Could not find artifact com.spotify:dockerfile-maven:jar:1.3.5 in central (https://repo.maven.apache.org/maven2)

nicklamer@host:~ > mvn dockerfile:build
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/com/spotify/dockerfile-maven/1.3.5/dockerfile-maven-1.3.5.pom
Downloaded: https://repo.maven.apache.org/maven2/com/spotify/dockerfile-maven/1.3.5/dockerfile-maven-1.3.5.pom (3 KB at 4.8 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/com/spotify/dockerfile-maven/1.3.5/dockerfile-maven-1.3.5.jar
[WARNING] Failed to retrieve plugin descriptor for com.spotify:dockerfile-maven:1.3.5: Plugin com.spotify:dockerfile-maven:1.3.5 or one of its dependencies could not be resolved: Could not find artifact com.spotify:dockerfile-maven:jar:1.3.5 in central (https://repo.maven.apache.org/maven2)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (13 KB at 62.9 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 98.0 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
...
[ERROR] No plugin found for prefix 'dockerfile' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/mrudnicki/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]

I've tried with https://mvnrepository.com as well.
Do I understand correctly that some dependencies wasn't push into public maven repository?

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.