0

I use FabricIO's Docker Maven Plugin.

I'm trying to create a docker tagged image with Docker Maven Pugin.

The build goal works, but when trying to tag the image, DMP fails:

Execution start of goal io.fabric8:docker-maven-plugin:0.40.2:tag failed: Cannot invoke "io.fabric8.maven.docker.config.BuildImageConfiguration.cleanupMode()" because "buildConfig" is null

docker-maven-plugin version : 0.40.2 (latest 2022-09)
Maven version (mvn -v) :
  • Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
  • Java version: 18.0.2-ea, vendor: Private Build, runtime: /usr/lib/jvm/java-18-openjdk-amd64
  • Ubuntu 22.04

I've also opened a bug here since it does not behave according to the documentation:e https://github.com/fabric8io/docker-maven-plugin/issues/1610

But maybe - Is there something could be doing wrong?


Here is the plugin part of my pom.xml.
Note that I put the docker:tag goal in place of docker:start so that it runs after docker:build if that being missing was the cause.

<plugin>
    <!-- The Docker Maven plugin is used to create docker image with the fat jar -->
    <groupId>io.fabric8</groupId><artifactId>docker-maven-plugin</artifactId><version>${version.docker-maven-plugin}</version>
    <configuration>
        <images>
            <image>
                <alias>mongo</alias>
                <name>mongo:5</name>
                <run>
                    <wait><time>6000</time><log>Waiting for connections</log></wait>
                    <log><prefix>MO</prefix><color>yellow</color></log>
                    <!-- Assign dynamically mapped ports to maven variable (which can be reused in integration tests) -->
                    <ports><port>mongo.port:27017</port></ports>
                    <env>
                        <MONGO_INITDB_ROOT_USERNAME>root</MONGO_INITDB_ROOT_USERNAME>
                        <MONGO_INITDB_ROOT_PASSWORD>kotlin4ever</MONGO_INITDB_ROOT_PASSWORD>
                    </env>
                </run>
            </image>

            <!-- Image holding the artifact of this build -->
            <image>
                <alias>service</alias><!-- Alias name which can used for linking containers during runtime -->
                <name>dacadoo/${project.artifactId}:${project.version}</name>

                <build>
                    <from>openjdk:20</from>
                    <assembly>
                        <descriptor>${basedir}/src/main/docker/docker-assembly.xml</descriptor>
                        <!--
                        <descriptorRef>artifact-with-dependencies</descriptorRef>
                        -->
                    </assembly>
                    <ports><port>8080</port></ports>
                    <!--
                    <cmd>java -jar /maven/tracker-service.jar</cmd>
                    -->
                    <entryPoint><exec><arg>java</arg><arg>-jar</arg><arg>/tracker-service.jar</arg></exec></entryPoint>
                </build>

                <!-- Runtime configuration for starting/stopping/linking containers -->
                <run>
                    <!-- Assign dynamically mapped ports to maven variables (which can be reused in integration tests) -->
                    <ports><port>service.port:8080</port></ports>
                    <wait>
                        <time>10000</time><url>http://${docker.host.address}:${service.port}/health</url>
                    </wait>
                    <links><link>mongo:mongo</link></links>
                    <log><prefix>TS</prefix><color>cyan</color></log>
                </run>
            </image>
        </images>
    </configuration>

    <!-- Hooking into the lifecycle -->
    <executions>
        <execution><id>start</id><goals><goal>build</goal><goal>tag</goal></goals><phase>pre-integration-test</phase></execution>
        <!--
        <execution><id>stop</id><goals><goal>stop</goal></goals><phase>post-integration-test</phase></execution>
        -->
    </executions>
</plugin>
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277

0 Answers0