标签: maven-docker-plugin

通过fabric8io docker-maven-plugin将.war部署到Docker镜像中

我是非常新的Docker和fabric8io docker-maven-plugin.我有一些困难时期将.war部署到我的图像中jboss/wildfly.我可以通过命令行成功构建.war附带的图像,但我不能通过已经提到的插件来做同样的事情.据我所知,一旦你给出正确的背景,Dockerfile它应该只是一个问题:

<build>
  <finalName>${project.build.finalName}.${project.packaging}</finalName>
  ...
  <assembly>
    <descriptorRef>artifact</descriptorRef>
  </assembly>
</build>
Run Code Online (Sandbox Code Playgroud)

但我得到这个错误:

[INFO] <<< docker-maven-plugin:0.19.0:build (default-cli) < package @ YoOffer <<<
[INFO] 
[INFO] --- docker-maven-plugin:0.19.0:build (default-cli) @ YoOffer ---
[WARNING] Cannot include project artifact: edu.pezzati.yo:YoOffer:war:0.0.1-SNAPSHOT; it doesn't have an associated file or directory.
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'edu.pezzati.yo:YoOffer'

[ERROR] DOCKER> Failed to create assembly for docker image  (with mode 'dir'): Error creating assembly archive docker: You …
Run Code Online (Sandbox Code Playgroud)

docker fabric8 maven-docker-plugin

10
推荐指数
1
解决办法
2478
查看次数

使用 spotify/dockerfile-maven-plugin 推送 docker hub 时出错

我有一个构建为 docker 镜像的 Maven 项目。我正在使用spotify/dockerfile-maven来构建这个镜像,并在 on 上自动将它推送到 docker.hub mvn clean install。该build阶段顺利通过。但是push我有这个错误:

[ERROR] denied: requested access to the resource is denied
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not push image
    at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:90)
........
Caused by: com.spotify.docker.client.exceptions.DockerException: denied: requested access to the resource is denied
    at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError(LoggingProgressHandler.java:105)
    at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:63)
......
Run Code Online (Sandbox Code Playgroud)

这是我的插件配置:

     <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>dockerfile-maven-plugin</artifactId>
                    <version>1.3.6</version>
                    <configuration>
                        <repository>${docker.image.prefix}/${project.artifactId}-istio</repository>
                        <tag>latest</tag>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>build</goal>
                                <goal>push</goal>
                            </goals>
                        </execution> …
Run Code Online (Sandbox Code Playgroud)

java maven docker dockerhub maven-docker-plugin

7
推荐指数
1
解决办法
2867
查看次数

将端口号从docker-maven-plugin传递到spring属性

我正在开发针对MySQL数据库的Spring Data JPA项目,并且我想从Maven运行端到端集成测试。

到目前为止,我已经配置io.fabric8.docker-maven-plugin为在pre-integration-test阶段中启动MySQL容器。它将使用一个随机的可用端口,我需要将该端口传递给我的application.properties文件。

我试着使用Maven自动属性扩展,但我怀疑mysql.portMaven的属性只得到解决后,春天属性得到更新。

pom.xml

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

    <groupId>example</groupId>
    <artifactId>pass-port-number-from-docker-maven-plugin-to-spring-property</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- other jpa dependencies ... -->

    </dependencies>

    <build>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>

            <plugin>
                <groupId>org.springframework.boot</groupId> …
Run Code Online (Sandbox Code Playgroud)

spring maven spring-data-jpa maven-docker-plugin

5
推荐指数
1
解决办法
652
查看次数

如何设置AWS ECS + dockerfile-maven-plugin?

我正在尝试设置我的项目pom.xml和 Maven,以自动生成 Docker 映像并将其推送到我的AWS ECSsettings.xml私有 Docker 存储库的过程。

在我的 中pom.xml,我添加了dockerfile-maven-plugin并配置如下:

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>dockerfile-maven-plugin</artifactId>
    <version>1.3.6</version>
    <executions>
        <execution>
            <id>default</id>
            <goals>
                <goal>build</goal>
                <goal>push</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <finalName>myproject/server</finalName>
        <repository>137037344249.dkr.ecr.us-east-2.amazonaws.com/myproject/server</repository>
        <tag>${docker.image.tag}</tag>
        <serverId>ecs-docker</serverId>
        <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
        <buildArgs>
            <VERSION>${project.version}</VERSION>
            <BUILD_NUMBER>${buildNumber}</BUILD_NUMBER>
            <WAR_FILE>${project.build.finalName}.war</WAR_FILE>
        </buildArgs>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

根据dockerfile-maven-plugin 给出的说明,我需要为 ECS 服务器身份验证添加配置,但我不知道需要提供什么用户名/密码。我怀疑这是我的 AWS 登录用户/密码。

<servers>
    <server>
        <id>ecs-docker</id>
        <username>where_to_get_this</username>
        <password>where_to_get_this</password>
    </server>
</servers>
Run Code Online (Sandbox Code Playgroud)

另外,欢迎任何以更好的方式自动生成 Docker 映像/推送到我的存储库的建议。

amazon-web-services amazon-ecs maven docker maven-docker-plugin

2
推荐指数
1
解决办法
5466
查看次数