Giter Club home page Giter Club logo

docker-maven-plugin's Introduction

Build Status Circle CI

WARNING!!! This project is no longer actively maintained. Please see this ticket for reasons and alternatives.

Docker Maven Plugin

This project aims to make it it easy to build an app on a container, test it and push it to a Docker repository, even if it relies on other containers (e.g. a database). We tend to talk "Maven" rather than "Docker" (E.g. "package" rather than "build"). And we like to keep it simple.

Using another tool? I have an Ant version, and a Gradle version (SBT coming soon...).

docker-maven-plugin's People

Contributors

alexec avatar alrighttheresham avatar andyp1per avatar bentolor avatar dacrome avatar djsly avatar dufgui avatar eemmiirr avatar hypery2k avatar lhallowes avatar lorijoan avatar oadam 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

docker-maven-plugin's Issues

Mapped Portbindings as system properties

It would be good to provide the mapped ports as system properties. I think, currently is just the container IP address as system property available, right?

The use case is very simple. There are environments using docker which doesn't allow to make the container IP address available remotely. They are not 'natted', for example security reasons. All communications goes over the mapped ports on the docker host.

Bump docker-java to 1.2.0

Could you please bump the docker-java version to 1.2.0 since the delete intermediate images bug is fixed there.

volumes are not working

conf.yml contains(tried many combinations):

packaging:
  add:
    - workfusion-web/target/mturk-web.war
    - workfusion-model/migrations
    - path: conf.yml
ports:
  - 8080

links:
  - mysql:workfusion-web_mysql
  - postgresql:workfusion-web_postgresql

volumes:
  - workfusion-web/target/:/usr/src/app/

tag: workfusion/tomcat_wf_cv

when running docker:start,stop,etc... I get the following error:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.528 s
[INFO] Finished at: 2015-05-20T16:00:14-04:00
[INFO] Final Memory: 50M/1963M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.8.4:stop (default-cli) on project workfusion-application: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token
[ERROR] at [Source: com.alexecollins.docker.orchestration.util.TokenReplacingReader@2918431c; line: 21, column: 2](through reference chain: com.alexecollins.docker.orchestration.model.Conf["volumes"])

tried with 2.8.4 & 2.8.6-SNAPSHOT

Am I doing something wrong?

Thanks,

Victor

Error on OS X with .DS_Store

I rarely get errors with .DS_Store files

Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.4.0:start (docker-prepare) on project webtest: java.io.IOException: Source '../src/main/docker/.DS_Store' exists but is not a directory -

Would be nice to filter them out by the plugin.

BTW: Awesome work. I love this plugin. Thanks for the great work

Port mapping problem

Hi @alexec,

it seems exposing ports is not working with latest docker version correctly. But maybe i did something wrong... As you see in the attached log i try to map container port 8080 to host port 8888 which is not working. Any ideas?

[INFO] Docker version 1.6.1
[INFO] Starting mb-restws-de
[INFO] No existing container so creating and starting new one
[INFO]  - env {}
[INFO]  - links []
[INFO]  - port 8888 8080
[INFO]  - port 9990
[INFO]  - volumes {}
[INFO] Sleeping for 0ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.125s
[INFO] Finished at: Wed May 20 09:53:36 CEST 2015
[INFO] Final Memory: 31M/230M
[INFO] ------------------------------------------------------------------------
linke-pb:mb-restws-de-deploy-ear marcus Java7 > docker ps
CONTAINER ID        IMAGE                                                                     COMMAND                CREATED             STATUS              PORTS                                                       NAMES
d08addf1b38e        29e3d92ef3ac0bd1830ac4795c8bdc41ddea524188ac4e9e8fc404879f97634e:latest   "/opt/jboss/wildfly/   10 hours ago        Up 7 seconds        8888/tcp, 0.0.0.0:9990->9990/tcp, 0.0.0.0:32773->8080/tcp   mb-restws-de-deploy-ear_mb-restws-de   

Logging output during build

Got the error below when building. I found this: kpelykh/docker-java#38
So it looks like this has been seen before.

Any ideas?
Ubuntu 14.04 64-bit
OpenJDK 7
Maven 3.1.1

[INFO] 1 * Client out-bound request
1 > GET http://127.0.0.1:4243/v1.11/version
1 > Accept: application/json

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.316s
[INFO] Finished at: Thu May 29 15:51:36 EDT 2014
[INFO] Final Memory: 15M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:1.0.0:package (default-cli) on project hyracks-server: org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1:4243 refused: Connection refused -> [Help 1]
[ERROR]

Error with docker 1.3.0 - Unexpected end of file from server

When I run mvn docker:package I get an error:

Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.1.0:package (default-cli) on project auction-query: java.net.SocketException: Unexpected end of file from server -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.1.0:package (default-cli) on project auction-query: java.net.SocketException: Unexpected end of file from server
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    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: java.net.SocketException: Unexpected end of file from server
    at com.alexecollins.docker.mojo.AbstractDockerMojo.execute(AbstractDockerMojo.java:110)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: javax.ws.rs.ProcessingException: java.net.SocketException: Unexpected end of file from server
    at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:229)
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246)
    at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:683)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424)
    at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:679)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:408)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:308)
    at com.github.dockerjava.jaxrs.VersionCmdExec.execute(VersionCmdExec.java:26)
    at com.github.dockerjava.jaxrs.VersionCmdExec.execute(VersionCmdExec.java:12)
    at com.github.dockerjava.jaxrs.AbstrDockerCmdExec.exec(AbstrDockerCmdExec.java:47)
    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:26)
    at com.alexecollins.docker.mojo.AbstractDockerMojo.execute(AbstractDockerMojo.java:106)
    ... 21 more
Caused by: java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:786)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:783)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
    at org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector.java:321)
    at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:227)
    ... 35 more

The command docker version shows:

Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): darwin/amd64
Server version: 1.3.0
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): c78088f
Maven version is 3.2.3
Java version is 1.8.0_11

I am using boot2docker. Its version is:

Boot2Docker-cli version: v1.3.0
Git commit: deafc19

The container name should be configurable

Use case: When you have multiple maven profiles to build a differently configured image it should be possible to start the containers side by side ... or because of problems with the circleci build because the tests run against a mysql and postgres database container ;)

[INFO] Image IDs do not match, removing container and creating new one from image
.
.
[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.8.2-SNAPSHOT:start
(start-docker-container) on project integration-tests:
com.github.dockerjava.api.InternalServerErrorException: Cannot destroy container 
6a639524d2b0506bd7e966891a0d55d6f7ce49091482040569f71d9beab1313a: 
Driver btrfs failed to remove root filesystem 
6a639524d2b0506bd7e966891a0d55d6f7ce49091482040569f71d9beab1313a: 
Failed to destroy btrfs snapshot: operation not permitted -> [Help 1]

I know this is more an issue of circleci but it would be a nice feature anyway and of course a workaround for the circleci limitation...

Fail to parse conf.yml when env is specified

conf.yml:
image:
tomcat:8-jre8
links:
- db
- spark
env:
- CRUNCH_HOME:/crunch-home
- environment:docker
ports:
- "9090:8080"
volumes:
- ${CRUNCH_HOME}/crunch-web-1.0.0-SNAPSHOT/:/usr/local/tomcat/webapps/crunch
- ${CRUNCH_HOME}/:/crunch-home

[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.8.6-SNAPSHOT:validate (default) on project crunch-web: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token
[ERROR] at [Source: com.alexecollins.docker.orchestration.util.TokenReplacingReader@15405bd6; line: 7, column: 7](through reference chain: com.alexecollins.docker.orchestration.model.Conf["env"])

Expose container ip address as maven properties

First, this is very nice work and I'm trying to use it to set up the integration test.

The problem I have is I have to bind the port number of a service in the container to a port of the host. This would make running several tests in parallel very diffcult and the port may have conflicts with the using port number of the host.

The solution I'm thinking is to expose the container's ip address as maven properties.
I just forked this repository and the orchestration-core, and add the support of this.

My changes and idea can be seen here:
http://git.io/vi5aeg
http://git.io/zDsWOA

This doesn't provide a generic way to expose any properties of the container, just the ip address.
If you think this is reasonable I can create a PR for this.

docker:clean does not remove image

Using docker:clean does not remove the previously built images. This leads to many unnamed (<none>) images that are building up on my image builder machine and waste precious disk space when building an image multiple times. I have prepared some files to demonstrate this issue: https://gist.github.com/tkrille/016926edc62b67e990b4

Affected Version: 1.3.1

Steps to reproduce:

  1. create maven project from supplied Gist
  2. run mvn package
  3. check image existence with docker images
  4. run mvn docker:clean
  5. check image existence with docker images

Expected:
Image has been removed.

Actual:
Image is still available.

Output from mvn docker:clean:

[INFO] --- docker-maven-plugin:1.3.1:clean (default-cli) @ docker-clean ---
[INFO] properties filtering supported for [project.name, project.version, project.build.finalName, project.groupId, project.artifactId]
11:43:09,755 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
11:43:09,756 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
11:43:09,756 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/home/tkrill/.m2/repository/com/alexecollins/docker/docker-maven-plugin/1.3.1/docker-maven-plugin-1.3.1.jar!/logback.xml]
11:43:09,770 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@2f1df832 - URL [jar:file:/home/tkrill/.m2/repository/com/alexecollins/docker/docker-maven-plugin/1.3.1/docker-maven-plugin-1.3.1.jar!/logback.xml] is not of type file
11:43:09,823 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
11:43:09,828 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [com.alexecollins.docker.util.MavenLogAppender]
11:43:09,829 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [MAVEN]
11:43:09,852 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:18 - no applicable action for [encoder], current pattern is [[configuration][appender][encoder]]
11:43:09,852 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@7:22 - no applicable action for [pattern], current pattern is [[configuration][appender][encoder][pattern]]
11:43:09,853 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
11:43:09,853 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [MAVEN] to Logger[ROOT]
11:43:09,854 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11:43:09,855 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5891b2c8 - Registering current configuration as safe fallback point

[INFO] Docker version 1.1.2
[INFO] clean app
[INFO] snoozing for 1000ms

Include a "skip" config option

Similar to other maven plugins, it would be very helpful to have a configuration option that allows one to skip execution of the plugin.

This helps avoid having to create a separate profile that controls whether or not the plugin is run.

Improvement : docker:tree

Docker registry is a great place to find images, info about the images excepted that when an image is build from another, you have to open the Dockerfile to discover the parents :

example : fabric8/karaf-2.4 -> fabric8/base-sti -> jboss/base-jdk:7 -> jboss/base --> fedora:20

And to understand, what finally will be deployed into a docker container, you must read the difinition of the dockerfile.

It should be great like the mvn dependency:tree to have a docker:tree goal generating a tree with the info calculated / inherited from the parents

Can not instantiate value of type [simple type, class com.alexecollins.docker.orchestration.model.Packaging] from String value (''); no single-String constructor/factory method

Iโ€™m trying to build my docker image with your plugin. Iโ€™ll get the following error when I try to build the image, which seems to be a bug:

[INFO] 1 * Sending client request on thread main
1 > GET http://localhost:2375/v1.13/version
1 > Accept: application/json

[INFO] 2 * Client response received on thread main
2 < 200
2 < Content-Length: 148
2 < Content-Type: application/json
2 < Date: Mon, 01 Dec 2014 10:22:33 GMT
2 < Job-Name: version
{"ApiVersion":"1.15","Arch":"amd64","GitCommit":"39fa2fa","GoVersion":"go1.3.3","KernelVersion":"3.13.0-40-generic","Os":"linux","Version":"1.3.2"}


[INFO] Docker version 1.3.2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.246 s
[INFO] Finished at: 2014-12-01T11:22:33+01:00
[INFO] Final Memory: 24M/273M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "default" could not be activated because it does not exist.
[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.2.0:package (push) on project rsp-docker: com.fasterxml.jackson.databind.JsonMappingException: Can not
instantiate value of type [simple type, class com.alexecollins.docker.orchestration.model.Packaging] from String value (''); no single-String constructor/factory method
[ERROR] at [Source: com.alexecollins.docker.orchestration.util.TokenReplacingReader@4860827a; line: 2, column: 11] (through reference chain: com.alexecollins.docker.orchestration.m
odel.Conf["packaging"])
[ERROR] -> [Help 1]
[ERROR]

Here is a sniplet from my POM:

<build>
             <plugins>
                    <plugin>
                           <groupId>com.alexecollins.docker</groupId>
                           <artifactId>docker-maven-plugin</artifactId>
                           <version>2.2.0</version>

                           <configuration>
        <!-- your installed version -->
        <version>1.13</version>

        <!-- change here if you are using another port/host, e.g. 4243 -->
        <host>http://localhost:2375</host>
        <!-- if you need to run over SSL, change this -->
        <dockerCertPath>${user.home}/.docker</dockerCertPath>
        <!-- remove images created by Dockerfile -->
        <removeIntermediateImages>true</removeIntermediateImages>
        <!-- do/do not cache images (default true), disable to get the freshest images -->
        <cache>true</cache>
    </configuration>

                           <executions>
                                  <execution>
                                        <id>push</id>
                                        <phase>compile</phase>
                                        <goals>
                                               <goal>package</goal>
                                        </goals>
                                  </execution>
                           </executions>
                           <dependencies>
<dependency>
<groupId>com.alexecollins.docker</groupId>
<artifactId>docker-java-orchestration-plugin-boot2docker</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
                    </plugin>
             </plugins>
       </build>

Default image name starts with 'null/'

I hadn't specified tag in conf.yml, and on version 2.1.0 this resulted in an image named project_app (for directory structure project/src/main/docker/app/conf.yml). But on version 2.2.0 the resulting image is null/project_app.

Docker Image doesn't get tagged properly

Hello folks,

I guess I have found a bug using the plugin.

In my conf.yml I have a line :
tag: XXX/YYY:${project.artifactId}-${project.version}

But the image gets tagged :
REPOSITORY TAG IMAGE ID CREATED
XXX/YYY ${project.artifactId}-${project.version} c53dea9ae48d 10 seconds ago

I use plugin version 1.4.0 with docker 1.2.0 and client 1.14.

Cheers,
Antoine

Excluded container is still trying to find by id

In my integration tests I'm running against mysql and postgres containers. I created for both maven profiles to start the tests only per database. When I excluded the opposite image/container, the docker-maven-plugin is still trying to find the excluded container. The docker-maven-plugin exclude the image/container in every step (clean, start), but before the tests starting the following exception was thrown:
Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.7.0:start (start-docker-container) on project integration-tests: no such id: integration-tests_mysql

conf.yml does not deal with absolute paths

If I use the dependency plugin properties task I get helpful properties that point at jars in my local repo. If I try and use this is conf.yml it fails because it is assuming everything added is relative to the ${basedir} which in this case it is not. Seems like it should detect whether the path is aboslute or relative and therefore determine whether to add ${basedir} or not.

docker:start failure on windows

Everything works on my mac but I just started testing this out on windows environment and am getting the following error:

C:\Users\CCS_Toshiba\Documents\trunk-r23686-docker>mvn docker:start -N -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
com.freedomoss.crowdcontrol:workfusion-application:pom:7.2.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for com.alexecollins.docker:docker-mave
n-plugin is missing. @ line 878, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WorkFusion Application 7.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- docker-maven-plugin:2.8.4:start (default-cli) @ workfusion-applicatio
n ---
[INFO] Docker version 1.6.0
[INFO] Loaded class com.alexecollins.docker.orchestration.plugin.virtualbox.Boot
2DockerPlugin plugin
[INFO] Starting postgresql
[INFO] Container already running
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.980 s
[INFO] Finished at: 2015-04-30T08:36:56-04:00
[INFO] Final Memory: 21M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.8.4
:start (default-cli) on project workfusion-application: exit code 1, VBoxManage.
exe: error: Code E_INVALIDARG (0x80070057) - One or more arguments are invalid (
extended info not available) VBoxManage.exe: error: Context: "RemoveRedirect(Bst
r(a->argv[3]).raw())" at line 523 of file VBoxManageControlVM.cpp -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal c
om.alexecollins.docker:docker-maven-plugin:2.8.4:start (default-cli) on project
workfusion-application: exit code 1, VBoxManage.exe: error: Code E_INVALIDARG (0
x80070057) - One or more arguments are invalid (extended info not available) VBo
xManage.exe: error: Context: "RemoveRedirect(Bstr(a->argv[3]).raw())" at line 52
3 of file VBoxManageControlVM.cpp
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre
adedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.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(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
356)
Caused by: org.apache.maven.plugin.MojoExecutionException: exit code 1, VBoxMana
ge.exe: error: Code E_INVALIDARG (0x80070057) - One or more arguments are invali
d (extended info not available) VBoxManage.exe: error: Context: "RemoveRedirect(
Bstr(a->argv[3]).raw())" at line 523 of file VBoxManageControlVM.cpp
at com.alexecollins.docker.mojo.AbstractDockerMojo.execute(AbstractDocke
rMojo.java:144)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:208)
... 20 more
Caused by: java.lang.RuntimeException: exit code 1, VBoxManage.exe: error: Code
E_INVALIDARG (0x80070057) - One or more arguments are invalid (extended info not
available) VBoxManage.exe: error: Context: "RemoveRedirect(Bstr(a->argv[3]).raw
())" at line 523 of file VBoxManageControlVM.cpp
at com.alexecollins.docker.orchestration.plugin.virtualbox.Boot2DockerPl
ugin.exec(Boot2DockerPlugin.java:85)
at com.alexecollins.docker.orchestration.plugin.virtualbox.Boot2DockerPl
ugin.deletePortForward(Boot2DockerPlugin.java:65)
at com.alexecollins.docker.orchestration.plugin.virtualbox.Boot2DockerPl
ugin.quietlyDeletePortForward(Boot2DockerPlugin.java:56)
at com.alexecollins.docker.orchestration.plugin.virtualbox.Boot2DockerPl
ugin.started(Boot2DockerPlugin.java:36)
at com.alexecollins.docker.orchestration.DockerOrchestrator.start(Docker
Orchestrator.java:271)
at com.alexecollins.docker.orchestration.DockerOrchestrator.start(Docker
Orchestrator.java:546)
at com.alexecollins.docker.mojo.StartMojo.doExecute(StartMojo.java:17)
at com.alexecollins.docker.mojo.AbstractDockerMojo.execute(AbstractDocke
rMojo.java:142)
... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

Unrecognized field "Paused"

Hi,

Receiving a json marshalling during a build. I have included the details at the bottom. The issue is actually occuring in alexec/docker-java, but manifested here.

I noticed that this issue has been found and fixed in the new "official" fork of kpelykh/docker-java -> docker-java/docker-java.

docker-java/docker-java#3

cheers


error occurs running docker-maven-plugin:1.2.0-SNAPSHOT:package a 2nd time on the same project.

after the following request:

[INFO] 4 * Client out-bound request
4 > GET http://192.168.59.103:2375/v1.9/containers/00accd1b3c51efe8bc2b4de1a87b648bde6637d1119f57bb47bddd0aa13ee824/json
4 > Accept: application/json

[INFO] 4 * Client in-bound response
4 < 200
4 < Content-Type: application/json
4 < Date: Sat, 28 Jun 2014 20:16:48 GMT
4 < Content-Length: 2007
4 <
{"ID":"00accd1b3c51efe8bc2b4de1a87b648bde6637d1119f57bb47bddd0aa13ee824","Created":"2014-06-28T20:16:21.38554651Z","Path":"/bin/sh","Args":["-c","$CATALINA_HOME/bin/startup.sh \u0026\u0026 tail -F $CATALINA_HOME/logs/catalina.out"],"Config":{"Hostname":"00accd1b3c51","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":{"8080/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["HOME=/","PATH=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64","CATALINA_HOME=/usr/local/tomcat"],"Cmd":["/bin/sh","-c","$CATALINA_HOME/bin/startup.sh \u0026\u0026 tail -F $CATALINA_HOME/logs/catalina.out"],"Image":"8b8f8b6048edda26ff4346c62501e3f9098c662959a7bf33e88a01b26a190f20","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":null},"State":{"Running":false,"Paused":false,"Pid":0,"ExitCode":-1,"StartedAt":"2014-06-28T20:16:22.56811803Z","FinishedAt":"2014-06-28T20:16:25.18060382Z"},"Image":"8b8f8b6048edda26ff4346c62501e3f9098c662959a7bf33e88a01b26a190f20","NetworkSettings":{"IPAddress":"","IPPrefixLen":0,"Gateway":"","Bridge":"","PortMapping":null,"Ports":null},"ResolvConfPath":"/etc/resolv.conf","HostnamePath":"/mnt/sda1/var/lib/docker/containers/00accd1b3c51efe8bc2b4de1a87b648bde6637d1119f57bb47bddd0aa13ee824/hostname","HostsPath":"/mnt/sda1/var/lib/docker/containers/00accd1b3c51efe8bc2b4de1a87b648bde6637d1119f57bb47bddd0aa13ee824/hosts","Name":"/devops-docker-tomcat_scrouch","Driver":"aufs","ExecDriver":"native-0.2","MountLabel":"","ProcessLabel":"","Volumes":{},"VolumesRW":{},"HostConfig":{"Binds":null,"ContainerIDFile":"null","LxcConf":null,"Privileged":false,"PortBindings":{"8080/tcp":[{"HostIp":"0.0.0.0","HostPort":"49154"}]},"Links":null,"PublishAllPorts":true,"Dns":null,"DnsSearch":null,"VolumesFrom":null,"NetworkMode":""}}

the build dies with this error:

[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:1.2.0-SNAPSHOT:start (default-cli) on project devops-docker-tomcat: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "Paused" (class com.kpelykh.docker.client.model.ContainerInspectResponse$ContainerState), not marked as ignorable (6 known properties: "StartedAt", "FinishedAt", "Pid", "ExitCode", "Running", "Ghost"])
[ERROR] at [Source: com.sun.jersey.client.apache4.ApacheHttpClient4Handler$HttpClientResponseInputStream@571efd; line: 1, column: 1028](through reference chain: com.kpelykh.docker.client.model.ContainerInspectResponse["State"]->com.kpelykh.docker.client.model.ContainerState["Paused"])

the offending request:

[INFO] 4 * Client out-bound request
4 > GET http://192.168.59.103:2375/v1.9/containers/00accd1b3c51efe8bc2b4de1a87b648bde6637d1119f57bb47bddd0aa13ee824/json
4 > Accept: application/json

[INFO] 4 * Client in-bound response
4 < 200
4 < Content-Type: application/json
4 < Date: Sat, 28 Jun 2014 20:16:48 GMT
4 < Content-Length: 2007
4 <
{"ID":"00accd1b3c51efe8bc2b4de1a87b648bde6637d1119f57bb47bddd0aa13ee824","Created":"2014-06-28T20:16:21.38554651Z","Path":"/bin/sh","Args":["-c","$CATALINA_HOME/bin/startup.sh \u0026\u0026 tail -F $CATALINA_HOME/logs/catalina.out"],"Config":{"Hostname":"00accd1b3c51","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":{"8080/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["HOME=/","PATH=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64","CATALINA_HOME=/usr/local/tomcat"],"Cmd":["/bin/sh","-c","$CATALINA_HOME/bin/startup.sh \u0026\u0026 tail -F $CATALINA_HOME/logs/catalina.out"],"Image":"8b8f8b6048edda26ff4346c62501e3f9098c662959a7bf33e88a01b26a190f20","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":null},"State":{"Running":false,"Paused":false,"Pid":0,"ExitCode":-1,"StartedAt":"2014-06-28T20:16:22.56811803Z","FinishedAt":"2014-06-28T20:16:25.18060382Z"},"Image":"8b8f8b6048edda26ff4346c62501e3f9098c662959a7bf33e88a01b26a190f20","NetworkSettings":{"IPAddress":"","IPPrefixLen":0,"Gateway":"","Bridge":"","PortMapping":null,"Ports":null},"ResolvConfPath":"/etc/resolv.conf","HostnamePath":"/mnt/sda1/var/lib/docker/containers/00accd1b3c51efe8bc2b4de1a87b648bde6637d1119f57bb47bddd0aa13ee824/hostname","HostsPath":"/mnt/sda1/var/lib/docker/containers/00accd1b3c51efe8bc2b4de1a87b648bde6637d1119f57bb47bddd0aa13ee824/hosts","Name":"/devops-docker-tomcat_scrouch","Driver":"aufs","ExecDriver":"native-0.2","MountLabel":"","ProcessLabel":"","Volumes":{},"VolumesRW":{},"HostConfig":{"Binds":null,"ContainerIDFile":"null","LxcConf":null,"Privileged":false,"PortBindings":{"8080/tcp":[{"HostIp":"0.0.0.0","HostPort":"49154"}]},"Links":null,"PublishAllPorts":true,"Dns":null,"DnsSearch":null,"VolumesFrom":null,"NetworkMode":""}}

NPE when running 'mvn -Prun-its verify`

When using mvn _X -Prun-its verify I get a NPE:

ERROR] Failed to execute goal org.apache.maven.plugins:maven-invoker-plugin:1.7:integration-test (integration-test) on project docker-maven-plugin: Execution integration-test of goal org.apache.maven.plugins:maven-invoker-plugin:1.7:integration-test failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-invoker-plugin:1.7:integration-test (integration-test) on project docker-maven-plugin: Execution integration-test of goal org.apache.maven.plugins:maven-invoker-plugin:1.7:integration-test 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:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution integration-test of goal org.apache.maven.plugins:maven-invoker-plugin:1.7:integration-test failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:144)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:514)
    at java.util.Hashtable.putAll(Hashtable.java:587)
    at org.apache.maven.plugin.invoker.AbstractInvokerMojo.getSystemProperties(AbstractInvokerMojo.java:1582)
    at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1470)
    at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1214)
    at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuilds(AbstractInvokerMojo.java:1133)
    at org.apache.maven.plugin.invoker.AbstractInvokerMojo.execute(AbstractInvokerMojo.java:670)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    ... 20 more

Is this a bug or how can I run the example ?

Image build order unknown

This maven docker plugin works great. Thanks a lot
`
My question is: Is it possible to define order how the plugin creates the images? I do have one base image which is the base for other images.

Thanks,
Ralf

java.io.IOException: Stream Closed

FROM melin/centos6-jdk7:latest

ADD ${project.artifactId}-${project.version}-bin.tar.gz /${project.artifactId}

RUN chmod +x /${project.artifactId}/bin/server.sh

CMD ["./${project.artifactId}/bin/server.sh"]

EXPOSE 8080

${project.artifactId}-${project.version}-bin.tar.gz file more 40m

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.197 s
[INFO] Finished at: 2014-08-21T22:51:42+08:00
[INFO] Final Memory: 12M/226M
[DEBUG] Connection manager is shutting down
[DEBUG] Connection manager shut down
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:1.4.0:start (default-cli) on project cloud-service-core: java.io.IOException: Stream Closed -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.alexecollins.docker:docker-maven-plugin:1.4.0:start (default-cli) on project cloud-service-core: java.io.IOException: Stream Closed
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: java.io.IOException: Stream Closed
at com.alexecollins.docker.mojo.AbstractDockerMojo.execute(AbstractDockerMojo.java:109)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Stream Closed
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:184)
at com.kpelykh.docker.client.utils.JsonClientFilter.handle(JsonClientFilter.java:17)
at com.sun.jersey.api.client.Client.handle(Client.java:652)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570)
at com.kpelykh.docker.client.DockerClient.build(DockerClient.java:913)
at com.alexecollins.docker.orchestration.DockerOrchestrator.build(DockerOrchestrator.java:173)
at com.alexecollins.docker.orchestration.DockerOrchestrator.build(DockerOrchestrator.java:141)
at com.alexecollins.docker.orchestration.DockerOrchestrator.start(DockerOrchestrator.java:367)
at com.alexecollins.docker.mojo.StartMojo.doExecute(StartMojo.java:15)
at com.alexecollins.docker.mojo.AbstractDockerMojo.execute(AbstractDockerMojo.java:106)
... 21 more
Caused by: java.io.IOException: Stream Closed
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:243)
at com.sun.jersey.core.util.ReaderWriter.writeTo(ReaderWriter.java:114)
at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.writeTo(AbstractMessageReaderWriterProvider.java:76)
at com.sun.jersey.core.impl.provider.entity.InputStreamProvider.writeTo(InputStreamProvider.java:98)
at com.sun.jersey.core.impl.provider.entity.InputStreamProvider.writeTo(InputStreamProvider.java:59)
at com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl.writeRequestEntity(RequestWriter.java:231)
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler$2.writeTo(ApacheHttpClient4Handler.java:262)
at org.apache.http.entity.BufferedHttpEntity.writeTo(BufferedHttpEntity.java:115)
at org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:98)
at org.apache.http.impl.client.EntityEnclosingRequestWrapper$EntityWrapper.writeTo(EntityEnclosingRequestWrapper.java:108)
at org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.java:122)
at org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(AbstractHttpClientConnection.java:271)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.sendRequestEntity(ManagedClientConnectionImpl.java:197)
at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:257)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:715)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:520)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:827)
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:170)
... 32 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

Add parameter to control removal of intermediate containers when building an image

When Docker builds an image, it generates intermediate containers for each step declared in the Dockerfile. docker build supports the --rm parameter to remove these intermediate containers after a successful build. It would be nice to set this parameter via the plugin configuration in the pom.xml. This way one can keep these containers for inspection on a development machine, but they will be removed on a dedicated build node (e.g. Jenkins), freeing the precious disk space.

Binary garbage on standard output of docker:install under Maven 3

While running docker:install goal, the following is printed to maven's standard output:

[INFO] 2 * Client out-bound request
2 > POST http://127.0.0.1:4243/v1.11/build?t=app-image_app
2 > Content-Type: application/tar
2 > Accept: text/plain
Dockerfile^@^@^@

... many megabytes of binary garbage omitted ...

^@^@^@

[INFO] 2 * Client in-bound response
2 < 200
2 < Content-Type: application/json
2 < Date: Mon, 14 Jul 2014 21:55:39 GMT
2 < Transfer-Encoding: chunked
2 < 

Debug output is nice, but dumping tar contents to the console is a tad excessive ;)

I was able to track this logging info to com.sun.jersey.api.client.filter.LoggingFilter added to Jersey ApacheHttpClient4 used by com.kpelykh.docker.client.DockerClient (introduced in commit alexec/docker-java-fix-its@7cbba4b)

Now, I see in https://github.com/alexec/docker-maven-plugin/blob/master/src/main/resources/logback.xml that the intention was to redirect this particular debug information into a file in project's target directory, but for some reason it does not work in the version of Maven I'm using (3.2.1). I presume it's different in your environment - it seems you are compiling against Maven 2.0.6 API.

It would be great if the capturing & logging of client/server communication were made optional. It's not needed when things are going well (hopefully most of the time) but capturing the stream using LoggingFilter and converting it into java.lang.String to write out to the log uses a lot of CPU cycles and memory.

Unsupported major.minor version 51.0

Alex,

Our team is experiencing build failure with the plugin. While I gather more details, have you seen the following error with the plugin:

[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.8.4:start (default-cli) on project workfusion-application: Execution default-cli of goal com.alexecollins.docker:docker-maven-plugin:2.8.4:start failed: Unable to load the mojo 'start' in the plugin 'com.alexecollins.docker
:docker-maven-plugin:2.8.4' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com/alexecollins/docker/mojo/StartMojo : Unsupported major.minor version 51.0

Client response status: 404

Hi,

after switching from version 1.9 to version 2.0 I get the following exception:

[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:1.4.0:package (default-cli) on project kinesis-producer: com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.alexecollins.docker:docker-maven-plugin:1.4.0:package (default-cli) on project kinesis-producer: com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
    at com.alexecollins.docker.mojo.AbstractDockerMojo.execute(AbstractDockerMojo.java:109)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: com.kpelykh.docker.client.DockerException: com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
    at com.kpelykh.docker.client.DockerClient.version(DockerClient.java:193)
    at com.alexecollins.docker.mojo.AbstractDockerMojo.execute(AbstractDockerMojo.java:105)
    ... 21 more
Caused by: com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:688)
    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
    at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509)
    at com.kpelykh.docker.client.DockerClient.version(DockerClient.java:188)
    ... 22 more

Cannot assign configuration entry 'host' to 'class java.net.URI'

Hi,

I have to following problem:

# mvn docker:package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Mediaslot Tracker
[INFO]    task-segment: [docker:package]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: com.alexecollins.docker:docker-maven-plugin:2.2.0

on the command line, specify: '-Ddocker.host=VALUE'

Cause: Cannot assign configuration entry 'host' to 'class java.net.URI' from '${docker.host}', which is of type class java.lang.String
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Wed Nov 19 15:17:48 CET 2014
[INFO] Final Memory: 22M/356M
[INFO] ------------------------------------------------------------------------

My maven-opts are:

# echo $MAVEN_OPTS
-Xms128m -Xmx1G -Ddocker.host=http://127.0.0.1:2375

Thanks and Regards,
Sascha

Unfiltered file URI used when building image

I'm using that latest version (1.2.0) and am seeing this issue when trying to package a docker image:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.2.0:package (default-cli) on project app: Source file /Users/xxxx/Documents/Workspace/xxxx/app/web/target/docker/app/app-@[email protected] doesn't exist

Caused by: com.github.dockerjava.api.DockerClientException: Source file /Users/xxxx/Documents/Workspace/xxxx/app/web/target/docker/app/app-@[email protected] doesn't exist
at com.github.dockerjava.core.command.BuildImageCmdImpl.buildDockerFolderTar(BuildImageCmdImpl.java:214)
at com.github.dockerjava.core.command.BuildImageCmdImpl.(BuildImageCmdImpl.java:48)
at com.github.dockerjava.core.DockerClientImpl.buildImageCmd(DockerClientImpl.java:227)
at com.alexecollins.docker.orchestration.DockerOrchestrator.build(DockerOrchestrator.java:153)
at com.alexecollins.docker.orchestration.DockerOrchestrator.build(DockerOrchestrator.java:119)
at com.alexecollins.docker.orchestration.DockerOrchestrator.build(DockerOrchestrator.java:363)
at com.alexecollins.docker.mojo.PackageMojo.doExecute(PackageMojo.java:16)
at com.alexecollins.docker.mojo.AbstractDockerMojo.execute(AbstractDockerMojo.java:107)

If I look in target/docker/app/ the Dockerfile, WAR and conf.yml are there and conf.yml has been correctly filtered so that @project.version@ has been replaced with the correct project version but for some reason the plugin is trying to use the unfiltered URL.

Running vanilla images & dynamic port mappings

It would be cool if it would be possible to run images which are not build by this plugin but simply pulled directly from a registry (like mysql or postgresql from dockerhub ?). This is especially useful for integration testing.

Also, for integration tests it would be cool if there would be a way to map dynamically assigned ports to maven properties which then can be reuse in the integration test (e.g. by setting them as system properties before executint the integration tests).

Since its more a wish list, I combined both topics. Feel free to cloes the issue if you don't plan to implement these features.

user properties not filtered in conf.yml

I'm guessing you know this since the code is clearly broken. But user properties are not filtered properly.

if if set <my.prop>foo</my.prop> in the pom and put ${my.prop} in conf.yml and then invoke mvn with:
mvn -Dmy.prop=bar clean install then ${my.prop} will be expanded to foo rather than bar.

License?

I don't see a license file in the repo, so I'm wondering what license you decided on (you mentioned GPL3 on your blog)? Just FYI, GPL (any flavor) would prevent me from using it (my company's a bit paranoid about making use of any GPL code). An Apache 2.0 or MIT license would be great.

Multipart upload for build is no longer supported

When I try to use the plugin to build the MySQL Dockerfile from your example, I get:

[INFO] 1 * Client out-bound request
1 > GET http://localhost:2375/v1.1.2/version
1 > Accept: application/json

[INFO] 1 * Client in-bound response
1 < 200
1 < Content-Type: application/json
1 < Job-Name: version
1 < Date: Sat, 02 Aug 2014 05:55:02 GMT
1 < Content-Length: 148
1 <
{"ApiVersion":"1.13","Arch":"amd64","GitCommit":"d84a070","GoVersion":"go1.2.1","KernelVersion":"3.15.3-tinycore64","Os":"linux","Version":"1    .1.2"}


[INFO] Docker version 1.1.2
[INFO] package mysql
[INFO] 2 * Client out-bound request
2 > POST http://localhost:2375/v1.1.2/build?t=hadoop_mysql
2 > Content-Type: application/tar
2 > Accept: text/plain
Dockerfile0100644 0000000 0000000 00000000523 12367641052 011605 0ustar000000000 0000000 FROM centos

#VOLUME /var/lib/mysql

RUN yum -y install mysql-server
RUN touch /etc/sysconfig/network

#RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/my.cnf

RUN service mysqld start &&  \
    sleep 5s && \
    mysql -e "GRANT ALL ON *.* to 'root'@'%'; FLUSH PRIVILEGES"

EXPOSE 3306

CMD ["/usr/bin/mysqld_safe"]



[INFO] 2 * Client in-bound response
2 < 500
2 < Content-Type: application/json; charset=utf-8
2 < Date: Sat, 02 Aug 2014 05:55:03 GMT
2 < Content-Length: 86
2 <
Multipart upload for build is no longer supported. Please upgrade your docker client.

As you can tell from this, I am running Docker version 1.1.2.

Is this a problem at my end, or am I missing something obvious?

Tagging problems

Hi,

I've problems tagging the images using the conf.yml:

packaging:
  add:
    - target/${project.artifactId}-${project.version}-fat.jar
ports:
  - 8080
tag: sm/${project.artifactId}:${project.version}

The result is:

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
sm/${project.artifactId} ${project.version} 5f441b308e2d 51 seconds ago 537.5 MB
centos latest b157b77b1a65 8 days ago 243.7 MB

I'm not sure if I've made a stupid mistake or if there is a problem replacing properties.

Thanks and Regards,
Sascha

Support disabling of cache during build

docker build supports disabling the build cache via the --no-cache parameter. Though it's a good thing to use the cache when you are actively working on a Dockerfile, it can lead to serious issues, if you really depend on the latest and freshest build of a Docker image, i.e. apt-get upgrade RUN stanzas will be cached by Docker daemon and so you end up with an image that does not contain latest updates. It would be really nice if we could control the usage of the build cache via pom.xml and system properties (like the way the removal of intermediate containers was implemented).

Deploy to Maven central

As most open source projects use Maven Central as their deployment server and as it is not a good Maven practice to put repositories inside pom.xml, could the docker maven plugin be deployed to Maven Central ?

Pushing to private registries?

Hi,

I'm just wondering if it is possible to a private Docker registry, like:

docker tag abc/xyz:1.2 registry_ip:5000/xyz:1.2
docker push registry_ip:5000/xyz:1.2

Thanks,
Sascha

Allow configurable file filter regex to control property replacements in staged files.

When alexec/docker-java-orchestration#17 is fixed, it will always replace files that are staged for Docker image creation.

By allowing a configurable file filter regex, it will prevent stray replacements. This is especially important for spring based configuration and property files where values (such as ${java.io.tmpdir} ) differ between build and runtime environments.

For example:

                <configuration>
                    <username>registry</username>
                    <password>registry</password>
                    <email>[email protected]</email>
                    <serverAddress>https://localhost:5443/v1</serverAddress>
                    <fileFilterRegex>Dockerfile|.*\.(sh|yml)</fileFilterRegex>
                </configuration>

docker:start failing on ubuntu 14

Hi Alex,

Ran into an issue with the plugin on ubuntu:

adminuser@adminuser-VirtualBox:~/Documents/workfusion$ mvn docker:start -N -Pdocker-linux
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.freedomoss.crowdcontrol:workfusion-application:pom:7.2.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for com.alexecollins.docker:docker-maven-plugin is missing. @ line 137, column 33
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WorkFusion Application 7.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- docker-maven-plugin:2.8.4:start (default-cli) @ workfusion-application ---
12:27:37,547 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
12:27:37,547 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
12:27:37,547 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/home/adminuser/.m2/repository/com/alexecollins/docker/docker-maven-plugin/2.8.4/docker-maven-plugin-2.8.4.jar!/logback.xml]
12:27:37,592 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@7f473ec7 - URL [jar:file:/home/adminuser/.m2/repository/com/alexecollins/docker/docker-maven-plugin/2.8.4/docker-maven-plugin-2.8.4.jar!/logback.xml] is not of type file
12:27:37,707 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
12:27:37,718 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [com.alexecollins.docker.util.MavenLogAppender]
12:27:37,718 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [MAVEN]
12:27:37,734 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:18 - no applicable action for [encoder], current ElementPath is [[configuration][appender][encoder]]
12:27:37,735 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@7:22 - no applicable action for [pattern], current ElementPath is [[configuration][appender][encoder][pattern]]
12:27:37,735 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
12:27:37,735 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [MAVEN] to Logger[ROOT]
12:27:37,735 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
12:27:37,739 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@1e6abc19 - Registering current configuration as safe fallback point

[INFO] I/O exception (org.apache.http.conn.UnsupportedSchemeException) caught when processing request: https protocol is not supported
[INFO] Retrying request
[INFO] I/O exception (org.apache.http.conn.UnsupportedSchemeException) caught when processing request: https protocol is not supported
[INFO] Retrying request
[INFO] I/O exception (org.apache.http.conn.UnsupportedSchemeException) caught when processing request: https protocol is not supported
[INFO] Retrying request
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.024s
[INFO] Finished at: Thu May 14 12:27:38 EDT 2015
[INFO] Final Memory: 12M/32M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.8.4:start (default-cli) on project workfusion-application: org.apache.http.conn.UnsupportedSchemeException: https protocol is not supported -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Thanks,

Victor

tagging images

this is more an RFI and if anything a request for an update to the documentation.

how do I define the repository and tag for an image I package and deploy?

i.e. lcoote/thingy:latest.

cheers

client and server don't have same version (client : 2.1, server: 1.14)

Hi,

I'm currently using your plugin in version 2.1 and I get the following error:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.alexecollins.docker:docker-maven-plugin:2.1.0:package (default-cli) on project kinesis-producer: client and server don't have same version (client : 2.1, server: 1.14)

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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)

My Docker version:

Client version: 1.2.0
Client API version: 1.14
Go version (client): go1.2
Git commit (client): fa7b24f/1.2.0
OS/Arch (client): linux/amd64
[info] GET /v1.14/version
[eed9dd4f] +job version()
[eed9dd4f] -job version() = OK (0)
Server version: 1.2.0
Server API version: 1.14
Go version (server): go1.2
Git commit (server): fa7b24f/1.2.0

Regards,
Sascha

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.