Tag: docker maven plugin

使用spring boot maven插件重新打包后,JAR文件中缺less资源

我的应用程序使用一些额外的文件,我有资源文件夹内。 当我使用Maven进行常规构build并将我的应用程序打包到JAR中时,我可以看到我的所有资源,以便解压缩该文件。 但是当我创build一个docker镜像时,我使用了spring-boot-maven-plugin来使我的JAR文件可执行。 出于某种原因, 我的资源没有被添加到新的重新包装的JAR中 。 此外,我甚至无法解压,因为它已经损坏。 这是我在我的pom.xml中设置重新打包目标的方式: <id>prod</id> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>1.5.3.RELEASE</version> <configuration> <mainClass>ApplicationName</mainClass> <executable>true</executable> <arguments> <argument>–spring.profiles.active=prod</argument> </arguments> <!–<addResources>true</addResources>–> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> <configuration> <!–<includeSystemScope>true</includeSystemScope>–> <!–<layout>JAR</layout>–> </configuration> </execution> </executions> </plugin> </plugins> </build> 我想补充说,当我在泊坞窗中运行我的图像它工作正常, 但所有需要的资源都缺less 。 有没有人遇到同样的问题? 或者,也许你可以build议如何解决它。

fabric8 docker-maven-plugin:在build上包含额外的标签

我在我的pom.xml中configuration了fabric8 docker-maven-plugin,如下所示: <build> … <plugins> … <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <version>${docker.plugin.version}</version> <executions> <execution> <phase>package</phase> <goals> <goal>build</goal> </goals> </execution> </executions> <configuration> <images> <image> <name>${docker.image.prefix}/${project.artifactId}:%l</name> <build> <dockerFile>Dockerfile</dockerFile> <assembly> <descriptorRef>artifact</descriptorRef> </assembly> </build> </image> </images> </configuration> </plugin> … </plugins> … </build> 如果版本包含-SNAPSHOT ,则使用用latest标签标记图像的%l占位符,否则使用pom版本。 从CI构build时,我想包括一些额外的标签(可能多于一个)到我的形象(例如内部编号/分支名称),但我想保持%l占位符行为。 我认为应该可以从命令行使用maven属性,但是我无法从插件文档中find它( https://dmp.fabric8.io/ ) 如何在执行docker时创build额外的标签:构build目标?

跨Maven概要文件的多个docker-maven插件

我目前的项目有3个Mavenconfiguration文件; runITs,postgres和mssql。 这些configuration文件结合起来,对两个数据库运行集成testingmvn -Ppostgres,runITs或mvn -Pmssql,runITs 。 postgres和mssqlconfiguration文件都使用fabric8io docker-maven-plugin来启动相应的数据库容器。 由于每次只激活其中一个configuration文件,所以这一切都可以正常工作。 我现在正尝试使用同一个插件为Samba共享运行另一个docker容器,但由于此容器应该运行而不pipe数据库,我试过在runITsconfiguration文件中包含另一个副本: <configuration> <images> <image> <alias>samba</alias> <name>dperson/samba</name> <run> <env> <SMB>true</SMB> </env> <ports> <port>445:445</port> </ports> <wait> <log>STATUS=daemon 'smbd' finished starting up and ready to serve connections</log> <time>60000</time> </wait> <log> <prefix>SAMBA</prefix> <date>none</date> <file>${project.build.directory}/samba.log</file> </log> <volumes> <bind> <volume>${project.build.directory}/samba-data:/media</volume> </bind> </volumes> <cmd>samba.sh -u example1;badpass -s media;/media;no;no;no;example1 -p</cmd> </run> </image> </images> </configuration> […]

docker-maven-plugin(io.fabric8) – 如何控制pg_hba.conf和postgresql.conf

我正在使用Maven插件io.fabric8:docker-maven-plugin在集成testing期间产生PostgreSQL数据库。 这将启动Docker容器中的PostgreSQL。 这很好。 我正在做如下: <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.22.1</version> <executions> <execution> <id>start</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> <configuration> <images> <image> <name>postgres:9</name> <run> <ports> <port>5432:5432</port> </ports> <wait> <log>database system is ready to accept connections</log> </wait> </run> </image> </images> </configuration> </execution> <execution> <id>stop</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> 对于某些function(复制相关的任务),我需要能够改变pg_hba.conf (添加复制用户)和postgresql.conf (添加复制槽)。 这可以通过Maven插件吗?

来自fabric8的docker-maven-plugin:tomcat和postgres容器之间的连接

我使用fabric8 docker-maven-plugin插件来设置两个容器: Postgres的 tomcat8 两个容器都可以单独设置好。 我可以从外部(从主机)连接到他们两个。 我正在做这个如下: <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.22.1</version> <configuration> <autoCreateCustomNetworks>true</autoCreateCustomNetworks> <images> <image> <alias>database</alias> <name>postgres:9</name> <run> <network> <name>network</name> <alias>database</alias> </network> <ports> <port>db-port:5432</port> </ports> <wait> <log>ready to accept connections</log> </wait> </run> </image> <image> <alias>container</alias> <name>inovatrend/tomcat8-java8</name> <run> <network> <name>network</name> <alias>tomcat</alias> </network> <dependsOn> <container>database</container> </dependsOn> <ports> <port>tomcat-port:8080</port> </ports> <wait> <http> <url>http://localhost:${tomcat-port}</url> </http> </wait> </run> </image> </images> […]

Maven,Docker获取主机系统的实际IP地址

使用Maven和docker-maven-plugin,我configuration了Apache Kafka + ZooKeeper容器: <image> <name>wurstmeister/zookeeper:${zookeeper.version}</name> <alias>zookeeper</alias> <run> <ports> <port>${zookeeper.port}:2181</port> </ports> </run> </image> <image> <name>wurstmeister/kafka:${kafka.version}</name> <alias>kafka</alias> <run> <ports> <port>9093:9092</port> </ports> <links> <link>zookeeper:zookeeper</link> </links> <env> <KAFKA_ADVERTISED_HOST_NAME>192.168.1.202</KAFKA_ADVERTISED_HOST_NAME> <KAFKA_ADVERTISED_PORT>9093</KAFKA_ADVERTISED_PORT> <KAFKA_ZOOKEEPER_CONNECT>zookeeper:${zookeeper.port}</KAFKA_ZOOKEEPER_CONNECT> </env> </run> </image> 正如你所看到的,为了得到它的工作,我必须提供我的主机系统的实际IP地址: <KAFKA_ADVERTISED_HOST_NAME>192.168.1.202</KAFKA_ADVERTISED_HOST_NAME> 在Maven或者docker-maven-plugin中有没有办法自动获得这个IP地址,而不需要硬编码呢? 更新 我find了允许我检索主机IP地址的插件: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <id>get-local-ip</id> <goals> <goal>local-ip</goal> </goals> <configuration> <localIpProperty>local.ip</localIpProperty> </configuration> </execution> </executions> </plugin> 但为了使用它,我需要在Maven命令的其余部分之前执行build-helper:local-ip目标: mvn build-helper:local-ip docker:start 如何绑定这个插件的某个阶段/目标,以便在一些早期的初始化阶段自动调用它,而不需要每次都手动调用build-helper:local-ip […]

我如何configurationcom.spotify.dockerfile-maven-plugin在Docker Toolbox上运行?

我开始使用com.spotify.docker-maven-plugin ,但是它是GitHub上的wiki,用于切换到com.spotify.dockerfile-maven-plugin 。 但是,在第一个插件中,我可以指定Docker主机,但我无法弄清楚如何与后者。 我的机器使用Docker工具箱运行Windows 7,所以本地没有Docker守护进程。 dockerfile-maven-plugin上的文档似乎没有解释如何做到这一点。 起初,maven的输出表明它试图连接到localhost:2375。 我已经改变了在虚拟框中的端口转发,以在docker机上将127.0.0.1:2375转发到2376。 这似乎没有工作。 我遵循这些指示: set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default set DOCKER_HOST=tcp://192.168.99.100:2376 set DOCKER_MACHINE_NAME=default set DOCKER_TLS_VERIFY=1 我已经设置了DOCKER_HOST环境variables,并检查了我的docker机输出: $ docker-machine.exe ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default * virtualbox Running tcp://192.168.99.100:2376 v17.06.1-ce 这会导致maven输出尝试连接到192.168.99.100:2376上的docker-machine,并在机器不运行时失败。 当机器正在运行时(这通过wget确认,文件是空的),这会导致不同的输出: Caused by: org.apache.http.ProtocolException: The server failed to respond with a valid HTTP response 更多的输出: [INFO] — […]

使用dockerfile-maven-plugin标记创build的图像

我正在使用dockerfile-maven-plugin和以下configuration: <plugin> <groupId>com.spotify</groupId> <artifactId>dockerfile-maven-plugin</artifactId> <version>1.3.6</version> <executions> <execution> <id>build-image</id> <goals> <goal>build</goal> </goals> <configuration> <tag>latest</tag> <repository>root/${project.artifactId}</repository> <buildArgs> <APP_NAME>${project.artifactId}</APP_NAME> </buildArgs> </configuration> </execution> <execution> <id>push-image</id> <goals> <goal>push</goal> </goals> <configuration> <repository>${docker.registry.url}/root/${project.artifactId}</repository> </configuration> </execution> </executions> </plugin> 项目部署因以下原因失败: [INFO] The push refers to a repository [my-repository:9090/root/image-name] [ERROR] An image does not exist locally with the tag: my-repository:9090/root/image-name [WARNING] An attempt failed, will […]

Docker for Windows和docker-maven-plugin – “SSLException:无法识别的SSL消息,明文连接”错误

我在本地Windows 10 Pro机器上使用Docker for Windows v1.13.0和docker-maven-plugin v0.4.13。 我正在使用mvn clean package docker:build构build我的项目并生成docker镜像。 构build失败: [INFO] ———————————————————————— [INFO] BUILD FAILURE [INFO] ———————————————————————— [INFO] Total time: 25.006 s [INFO] Finished at: 2017-01-19T14:48:45-02:00 [INFO] Final Memory: 68M/619M [INFO] ———————————————————————— [ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default-cli) on project monitoramentoRS: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? -> […]