wouterd / docker-maven-plugin Goto Github PK
View Code? Open in Web Editor NEWA maven plugin to manage docker containers and images for integration tests.
License: Apache License 2.0
A maven plugin to manage docker containers and images for integration tests.
License: Apache License 2.0
Hi Wouter,
I just started looking at the plugin, which looks nice, but I can't get it to run yet. Use case is integration tests with a MySQL container.
Using the config:
<build>
<plugins>
<plugin>
<groupId>net.wouterdanes.docker</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>start</id>
<configuration>
<containers>
<container>
<id>MySQL</id>
<image>mysql</image>
</container>
</containers>
</configuration>
<goals>
<goal>start-containers</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<goals>
<goal>stop-containers</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
result in the following error:
WARNING: Error injecting: net.wouterdanes.docker.maven.StartContainerMojo
com.google.inject.ConfigurationException: Guice configuration errors:
1) Could not find a suitable constructor in net.wouterdanes.docker.maven.StartContainerMojo. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
at net.wouterdanes.docker.maven.StartContainerMojo.class(StartContainerMojo.java:53)
while locating net.wouterdanes.docker.maven.StartContainerMojo
Inspecting the classes and the configuration I have the idea that everything should work...
The integration tests need a docker registry.
It would be nice if the build starts a docker container running a docker registry for integration testing purposes. @lcoote: interested?
Hi Wouter,
I really like your docker-maven-plugin, however the lack of the VOLUME feature in the plugin is the only thing I miss. Can you tell me if in some other way it is possible to make a docker directory accessible from outside the container? Or do you think this feature will be available soon?
E
In other words, the same Dockerfile should be used for both the maven plugin and be usable from the command line. This is currently not working with ONBUILD ADD
.
Use case: I want to build a jar, then ONBUILD ADD
it to the Docker image using the Docker maven plugin. I also want to be able to create the image by hand, using mvn package && docker build -t tag .
Currently, the files that need to be included in the image are put into a .tar.gz
in the root level of the archive.
My Dockerfile adds files from the target
directory, the default for maven builds. In the Dockerfile:
ONBUILD ADD target/jarname.jar
This will work with docker build
but not with the plugin because on the remote Docker host (boot2docker in my case) the build environment has all the files in the root so the Dockerfile should contain:
ONBUILD ADD jarname.jar
It would be great to be able to use the same Dockerfile for command line and maven plugin usage.
It would be useful to be able to "run" the project as well as integration test it.
The docker:run goal would build the images, start up the server and then when the user presses "ctrl-c" tear everything down again.
in many instances DockerExceptions that occur during mojo execution are caught, logged then suppressed.
is this a deliberate design decision? if so can we make this configurable?
Hi,
I just installed your plugin and when starting my container I get this error:
Failed to execute goal net.wouterdanes.docker:docker-maven-plugin:4.1.0:start-containers (start) on project alinto-ui-webapp: Execution start of goal net.wouterdanes.docker:docker-maven-plugin:4.1.0:start-containers failed. BufferUnderflowException -> [Help 1]
Any thought ?
Thanks !
Hi,
I'm trying to use the plugin when running my integration tests. I have it configured to start an instance of Eureka and my service:
<configuration>
<containers>
<container>
<id>eureka</id>
<image>dockerhub.myradio.thisisglobal.com/eureka:latest</image>
<waitForStartup>Started EurekaApplication</waitForStartup>
<hostname>eureka</hostname>
</container>
<container>
<id>content-link-service</id>
<image>dockerhub.myradio.thisisglobal.com/content-link-service:latest</image>
<env>
<spring.profiles.active>docker-integration-tests</spring.profiles.active>
</env>
<waitForStartup>registration status: 204</waitForStartup>
<hostname>content-link-service</hostname>
<links>
<link>
<containerId>eureka</containerId>
<containerAlias>eureka</containerAlias>
</link>
</links>
</container>
<configuration>
When running mvn clean verify
I can see docker has started the 2 containers and exposed the relevant ports:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a7a934f5affa dockerhub.myradio.thisisglobal.com/content-link-service:latest "java -Djava.securit About a minute ago Up About a minute 0.0.0.0:33061->9092/tcp prickly_darwin
55bbb289f146 dockerhub.myradio.thisisglobal.com/eureka:latest "java -Djava.securit 2 minutes ago Up 2 minutes 0.0.0.0:33057->8761/tcp, 0.0.0.0:33060->9092/tcp backstabbing_pasteur
I'm not sure why the Eureka container has also exposed the service port 9092 though. When I run my code and Feign tries to connect the service via Eureka I get the exception:
java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: content-link-service
at feign.ribbon.RibbonClient.execute(RibbonClient.java:75)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:92)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:71)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:94)
at com.sun.proxy.$Proxy95.getStations(Unknown Source)
at com.globalradio.myradio.admingateway.controller.StationsController.getStations(StationsController.java:34)
Any ideas why this might be happening? I know the infrastructure works fine, as the tests execute fine if I start the containers manually:
docker run -d -p 8761:8761 --name eureka dockerhub.myradio.thisisglobal.com/eureka
docker run -d -p 9090:9090 --name station-service --link eureka:eurkea -e spring.profiles.active=docker-integration-tests dockerhub.myradio.thisisglobal.com/content-link-service
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ee1d03c40fe7 dockerhub.myradio.thisisglobal.com/content-link-service:latest "java -Djava.securit 18 seconds ago Up 16 seconds 0.0.0.0:9092->9092/tcp content-link-service
ad83909eacdd dockerhub.myradio.thisisglobal.com/eureka:latest "java -Djava.securit 21 seconds ago Up 20 seconds 9092/tcp, 0.0.0.0:8761->8761/tcp eureka
Notice that this time the Eureka container hasn't exposed the 9092 port.
Have you considered to publish to host the result of the container inspection? I think it will be useful to know, for instance, its IP address or its hostname.
Is it possible to be informed about failures that occur during image build?
Preferably being able to terminate the maven build if an error occurs during Dockerfile "execution".
It would also be great to see the output from the individual Dockerfile lines.
As of now I have to use "docker build ..." explicitly (including having to put all input file under one directory) in order to make sure that my image builds OK.
ImageBuildConfiguration class contains a required 'dockerFile' attribute.
In the documentation, 'dockerfile' is used: this won't build.
Best part of the story: I would have preferred 'dockerfile' to be the tag name :)
I cloned the project and ran mvn clean verify -Prun-its
. This resulted in a build failure. The message was:
[ERROR] Failed to execute goal net.wouterdanes.docker:docker-maven-plugin:2.0:start-containers (start-containers) on project docker-maven-plugin: Execution start-containers of goal net.wouterdanes.docker:docker-maven-plugin:2.0:start-containers failed: java.net.SocketException: Unexpected end of file from server -> [Help 1]
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
To prevent issues like #18
This may well be me but when I try to use the ADD command in my Dockerfile it can't see the files in the target directory (even though the pathing in the error message looks right).
I created an example project to illustrate this - https://github.com/mikeycmccarthy/ci-with-docker-test.
Cheers!
If I understand right, when building via a Dockerfile, variables (like ${project.build.finalName}.jar
) doesn't get replaced. This would be a cool feature allowing a more flexible way for creating images.
The plugin's unit tests break with Docker 1.4, so it's probable that the plugin doesn't support Docker 1.4.
I'm trying to build an image and have the following as my Dockerfile
FROM java:8
EXPOSE 9092
ADD content-link-service-*.jar app.jar
When I run this I get the following output
[ERROR] Cannot build image 'content-link-service'
net.wouterdanes.docker.remoteapi.exception.DockerException: Can't obtain ID from build output stream.
at net.wouterdanes.docker.remoteapi.MiscService.buildImage(MiscService.java:74)
at net.wouterdanes.docker.provider.RemoteApiBasedDockerProvider.buildImage(RemoteApiBasedDockerProvider.java:100)
at net.wouterdanes.docker.maven.BuildImageMojo.doExecute(BuildImageMojo.java:60)
at net.wouterdanes.docker.maven.AbstractDockerMojo.execute(AbstractDockerMojo.java:86)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
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: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: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)
[INFO] Api response:
{"stream":"Step 0 : FROM java:8\n"}
{"stream":" ---\u003e 64fb28226dbe\n"}
{"stream":"Step 1 : EXPOSE 9092\n"}
{"stream":" ---\u003e Using cache\n"}
{"stream":" ---\u003e 726eb601d9fd\n"}
{"stream":"Step 2 : ADD content-link-service-*.jar app.jar\n"}
{"errorDetail":{"message":"No source files were specified"},"error":"No source files were specified"}
What am I doing wrong here? If I get rid of the Add it works fine.
Thanks
Nick
Currently, when pushing the built images to a remote docker registry in a multi-module build, each module builds, then immediately pushes its Docker image to the registry.
When a module in the middle fails to build, no images should have been pushed.
I could not find a way to achieve this, although the plugin suggests it can be done, using the push
tag in the build-images
goal, then doing the actual pushing in a different phase.
When containers are linked together they are typically a runtime dependency. E.g. an application container has to wait for a database container to startup. So it would be cool if one could block the startup of the application container until the db container is up.
waitForStartup
works only for the overall start-containers
goal. It seems that the containers startup in parallel: Start all containers then for all containers with a waitForStartup
wait for the corresponding message in the console. IMO for linked containers it would be better to: Start db container, wait for output, start app container, wait for output.
Images that need to be pushed, but don't have keep = true should be removed after they are pushed.
Else build servers could get seriously cluttered.
f.ex in ${project.builddir}/docker-plugin/docker-mappings.properties
That way the whole properties file can be loaded as system properties by the failsafe plugin.
I've program starting the containers with the plugin
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building search-svc 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- docker-maven-plugin:3.0:start-containers (default-cli) @ search-svc ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.327 s
[INFO] Finished at: 2015-03-19T22:41:36-07:00
[INFO] Final Memory: 9M/238M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.wouterdanes.docker:docker-maven-plugin:3.0:start-containers (default-cli) on project search-svc: The parameters 'containers' for goal net.wouterdanes.docker:docker-maven-plugin:3.0:start-containers are missing or invalid -> [Help 1]
<execution>
<id>start</id>
<goals>
<goal>start-containers</goal>
</goals>
<configuration>
<containers>
<container>
<image>${project.name}:${project.version}</image>
</container>
</containers>
</configuration>
</execution>
mvn --version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T06:51:42-07:00)
Maven home: /opt/apache-maven-3.2.2
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-31-generic", arch: "amd64", family: "unix"
however, it can start & stop the container through the verify goal.
[INFO] --- docker-maven-plugin:3.0:build-images (build) @ search-svc ---
[INFO] Using docker provider: remote
[INFO] Building image 'search', with name and tag 'search-svc:1.0-SNAPSHOT'..
[INFO] Image 'search' has Id 'cf3e355fc5ce'
[INFO]
[INFO] --- docker-maven-plugin:3.0:start-containers (start) @ search-svc ---
[INFO] Using docker provider: remote
[INFO] Starting container 'search-svc:1.0-SNAPSHOT'..
[INFO] Setting property 'docker.containers.search-svc:1.0-SNAPSHOT.ports.8080/tcp.host' to '127.0.0.1'
[INFO] Setting property 'docker.containers.search-svc:1.0-SNAPSHOT.ports.8080/tcp.port' to '49155'
[INFO] Started container with id '77103f93ef186e6bb5b1812979176bdac57b66f7c263cc6483a1262d2dd2dc07'
[INFO]
[INFO] --- docker-maven-plugin:3.0:stop-containers (stop) @ search-svc ---
[INFO] Using docker provider: remote
[INFO] Stopping container '77103f93ef186e6bb5b1812979176bdac57b66f7c263cc6483a1262d2dd2dc07'..
[INFO] Deleting container '77103f93ef186e6bb5b1812979176bdac57b66f7c263cc6483a1262d2dd2dc07'..
[INFO] Keeping image cf3e355fc5ce
[INFO]
[INFO] --- docker-maven-plugin:3.0:verify (verify) @ search-svc ---
[INFO] Using docker provider: remote
Hello:
Would it be possible to modify the plugin to show the docker build output? E.g...
Step 0 : FROM m-ubuntu
---> f898fb0ac394
Step 1 : MAINTAINER Steve
---> Using cache
---> 20341d993499
Step 2 : RUN apt-get update && apt-get install -y supervisor swift
---> Using cache
---> c63eb3d812e9
Currently, I don't think you can see this output even when doing a mvn build with debug output (-X). The reason I'd like to see this output is to see how well we are doing at preserving the cache. I'm afraid we have a few images that are not making good use of the docker cache and I'd like to have this output so I can more easily point it out to other developers...
Also, thanks for releasing 3.0.1!
File 'docker-entrypoint.sh' is in the same folder as the Dockerfile. Execution of 'docker build' in console works as expected. Maybe a path problem?
By the way: It is imho not a good idea that Maven finished with "BUILD SUCCESS" although the
image-creation did non succeed.....
Step 7 : COPY docker-entrypoint.sh /docker-entrypoint.sh
ERROR: docker-entrypoint.sh: no such file or directory
[ERROR] Cannot build image 'cassandra'
net.wouterdanes.docker.remoteapi.exception.DockerException: Can't obtain ID from build output stream.
at net.wouterdanes.docker.remoteapi.MiscService.buildImage(MiscService.java:85)
at net.wouterdanes.docker.provider.RemoteApiBasedDockerProvider.buildImage(RemoteApiBasedDockerProvider.java:100)
at net.wouterdanes.docker.maven.BuildImageMojo.doExecute(BuildImageMojo.java:60)
at net.wouterdanes.docker.maven.AbstractDockerMojo.execute(AbstractDockerMojo.java:86)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
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: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: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)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:11 min
[INFO] Finished at: 2015-07-15T16:40:07+02:00
[INFO] Final Memory: 21M/484M
Sample build which suffers from this:
pre-integration-test:
* docker container is started to act as a database
* some setup tasks run to init the db
* cargo runs a web app which uses the dockerised db
integration-test:
* tests are run
post-integration-test:
* cargo container is stopped
* docker container is destroyed
In a normal CI run this works fine, but when -Dcargo.wait is specified (to manually interact with the web app) then the build intentionally hangs after the cargo exec in pre-integration-test, with a prompt to kill the web app using Ctrl+C, and that means the starter containers aren't cleaned up. (cargo:run
isn't an option due to the setup tasks, even if it was ok to run the db separately)
I don't know of a maven-provided way to trap ctrl+c, but I've prototyped a fix for this by adding a JVM shutdown hook.
Hi,
When trying to use ${docker.containers.mysql.ports.3306/tcp.host} and ${docker.containers.mysql.ports.3306/tcp.port} in my properties file, the '/' causes issues to replace placeholders. I tried escaping it with , quoting it, ...
Nothing works. Any ideas ?
Thanks !
See #77
The plugin currently connects to docker using the rest api.
It would be nice to also have unix socket support.
A pull from a secured (private) egistry fails silently. After debugging the problem is found to be in the authentication.
See commit 684f36a for a fix.
The build-images goal currently doesn't check for duplicate IDs, this could create weird behavior.
It would be nice to include a maven dependency to an image in the build images mojo.
F.ex org.example:awesome-app:1.0:war
Should leverage aether to resolve artifacts.
Is it possible to set the container's hostname (identical to the -h option of the docker run command) when a container is created?
I see that @Krijger created a fork to handle a socket provider. Any ideas where he is with this, and if it'll ever be committed back to the main repo?
I've been trying to use the sample POM XML for my project:
<plugin>
<groupId>net.wouterdanes.docker</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<userName>....</userName>
<password>....</password>
<email>....</email>
</configuration>
<executions>
<execution>
<id>build</id>
<goals>
<goal>build-images</goal>
</goals>
<configuration>
<images>
<image>
<id>content-link-service</id>
<dockerFile>${project.basedir}/src/main/docker/Dockerfile</dockerFile>
<nameAndTag>nickcodefresh/content-link-service:${project.version}</nameAndTag>
<artifacts>
<artifact>
<file>${project.basedir}/target/${project.artifactId}-${project.version}.jar</file>
<dest>${project.artifactId}.jar</dest>
</artifact>
</artifacts>
<keep>true</keep>
<push>true</push>
<registry>https://registry.hub.docker.com</registry>
</image>
</images>
</configuration>
</execution>
<execution>
<id>start</id>
<configuration>
<containers>
<container>
<id>Debian</id>
<image>debian:wheezy</image>
</container>
<container>
<id>BusyBox</id>
<image>busybox</image>
<hostname>busyhost</hostname>
</container>
<container>
<id>cache</id>
<image>nginx</image>
</container>
</containers>
</configuration>
<goals>
<goal>start-containers</goal>
</goals>
</execution>
<execution>
<id>push</id>
<goals>
<goal>push-images</goal>
</goals>
</execution>
</executions>
</plugin>
When I run mvn -X docker:build-images I'm getting the error:
[ERROR] Failed to execute goal net.wouterdanes.docker:docker-maven-plugin:3.0:build-images (default-cli) on project content-link-service: The parameters 'images' for goal net.wouterdanes.docker:docker-maven-plugin:3.0:build-images are missing or invalid -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.wouterdanes.docker:docker-maven-plugin:3.0:build-images (default-cli) on project content-link-service: The parameters 'images' for goal net.wouterdanes.docker:docker-maven-plugin:3.0:build-images are missing or invalid
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:220)
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: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)
Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'images' for goal net.wouterdanes.docker:docker-maven-plugin:3.0:build-images are missing or invalid
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:665)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:618)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Is the sample POM XML valid? It doesn't appear to be to me
Can you clarify what is meant by:
By default, all exposed ports are published on the host. The following two properties are set per exposed port:
docker.containers.[id].ports.[portname].host (f.ex 'docker.containers.id.cache.ports.80/tcp.host')
docker.containers.[id].ports.[portname].port (f.ex 'docker.containers.id.cache.ports.80/tcp.port')You can pass those project properties over to your integration test and use them to connect to your application.
How can I pass these properties in my test? Are they exposed as system properties?
Thanks
Nick
Gzipping to a local docker daemon doesn't make much sense and can slow down builds. It should be optional.
The start-containers goal currently doesn't check for duplicate container IDs, this could cause erratic behavior.
As a Java-developer (and maven user) it would be quite cool if I could use a docker-registry in the same way as a Maven-Repostory: I want to push (immutable) releases and snapshot-versions which will be overwritten with the next deploy. Since docker-registry does not support this behaviour (every tag is immutable - except the tag 'latest'). Wouldn't it make sense to handle this client-side (inside docker-maven-plugin for example)?
If the plugin detects a snapshot, it checks if an image-tag with that name already exists and if so it will be removed before pushing the newly created snapshot to registry.
Imho this would make many things easier in a maven-driven-environment....
Client version: 1.5.0-dev
Client API version: 1.18
Go version (client): go1.3.1
Git commit (client): fc0329b/1.5.0
OS/Arch (client): linux/amd64
Server version: 1.5.0-dev
Server API version: 1.18
Go version (server): go1.3.1
Git commit (server): fc0329b/1.5.0
OS/Arch (server): linux/amd64
18:38:48ย [ERROR] Failed to execute goal net.wouterdanes.docker:docker-maven-plugin:3.0:tag-images (release) on project kafka: Failed to add tag 'a1f22d36d8ed' to image 'bmcgeneva:kafka-1.0.0-SNAPSHOT-latest': Conflict -> [Help 1]
docker tag -f a1f22d36d8ed bmcgeneva:kafka-1.0.0-SNAPSHOT-latest
Any ideas ? Is it the version a problem ?
<build>
<plugins>
<plugin>
<groupId>net.wouterdanes.docker</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>3.0</version>
<executions>
<execution>
<id>build</id>
<goals>
<goal>build-images</goal>
</goals>
<configuration>
<images>
<image>
<id>test</id>
<dockerFile>src/main/resources/Dockerfile</dockerFile>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
gives a
`
Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'images' for goal net.wouterdanes.docker:docker-maven-plugin:3.0:build-images are missing or invalid
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:584)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:537)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:119)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
`
for `mvn docker:build-images`
Can't figure out what is missing.
In the start containers goal, it should be possible to link started containers.
Docker only supports linking a currently running containers, so validation needs to happen so that containers are started in the right order. First iteration should just check that the user doesn't try to link something before it is started.
Later iterations could try to juggle the container start order in such a way that linking works.
When starting f.ex tomcat, it logs "SERVER STARTUP IN ..." when it's done initializing and deploying applications.
First iteration: the plugin should wait for something configurable to pass in the stdout.
Lateron: the plugin could monitor some file on the container's filesystem for a certain log entry.
Hi,
I have installed docker 1.6. I am using this plugin to build, tag and push the image to dockerhub. But I am facing problem while tagging the image as latest.
The same will work with Docker version 1.3. But I am getting the tag error with docker version 1.6. Please help me what I need to change in order to make it work.
[INFO] --- docker-maven-plugin:3.1-SNAPSHOT:tag-images (tag) @ VehicleBusiness ---
[INFO] Using docker provider: remote
[INFO] Tagging image '2bba9b26af01' with tag 'preetick/business:latest'..
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.498 s
[INFO] Finished at: 2015-06-29T12:43:46+00:00
[INFO] Final Memory: 15M/92M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal net.wouterdanes.docker:docker-maven-plugin:3.1-SNAPSHOT:tag-images (tag) on project VehicleBusiness: Failed to add tag '2bba9b26af01' to image 'preetick/business:latest': Conflict -> [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/MojoFailureException
[JENKINS] Archiving /var/lib/jenkins/workspace/VehicleBusiness/pom.xml to com.mindtree.vehiclebusiness.entity/VehicleBusiness/3.2/VehicleBusiness-3.2.pom
[JENKINS] Archiving /var/lib/jenkins/workspace/VehicleBusiness/target/VehicleBusiness.war to com.mindtree.vehiclebusiness.entity/VehicleBusiness/3.2/VehicleBusiness-3.2.war
channel stopped
Finished: FAILURE
Not sure if I'm just not seeing this: how can I configure the plugin to name/tag the images?
Reproduce this by:
docker images
The previous image gets untagged but not deleted. This results in a dangling image.
Can the previous image be deleted automatically?
I am using OSX with boot2docker.
$ boot2docker version
Boot2Docker-cli version: v1.3.0
Git commit: deafc19
$ docker --version
Docker version 1.3.0, build c78088f
HI,
For our integration tests we need to generate a license based on the mac address. The ability to specify a fixed mac address would help us a lot. Docker already allow that and we use this feature by launching docker via a bash script and maven-exec-plugin.
Thanks !
Especially when docker containers are cleaned up after a build, it would be useful to have the option to save the logs to files under target. PR to follow.
I noticed this under your "future" section: 'Create some kind of "wait for stuff to initialize" step: for example, Tomcat starting up.'
I have this requirement right now in my project. I wouldn't mind taking a stab at it. before I did I thought I might consult you to see if you had any pre-existing opinions about how this should be implemented and how it would fit consistently into your existing design and plans.
cheers
Hi,
I would be great to provide an option to remove associated container volume when tests end.
Thanks !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.