0

I am trying to integrate maven dockerfile plugin with my project. I have multiple modules under my maven project. I have modified the pom.xml for the module I want to build and tag images as below. Running mvn dockerfile:build command builds a creates a docker-info.jar under the target folder. I am not sure where the images are being built and when I try to run the mvn dockerfile:tag command I see the below error.

Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.4:tag (default-cli) on project drs-web: The parameters 'repository' for goal com.spotify:dockerfile-maven-plugin:1.4.4:tag are missing or invalid

Pom.xml:

    <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>${docker.maven.plugin.version}</version>
                    <executions>
                        <execution>
                            <id>build</id>
                            <goals>
                                <goal>build</goal>
                            </goals>
                            <configuration>
                                <buildArgs>
                                    <WAR_FILE>${project.build.finalName}.war</WAR_FILE>
                                </buildArgs>
                            </configuration>
                        </execution>
                        <execution>
                            <id>tag</id>
                            <goals>
                                <goal>tag</goal>
                            </goals>
                            <configuration>
                                <repository>XXX/XXX-api</repository>
                                <tag>${project.version}</tag>
                            </configuration>
                        </execution>
                    </executions>
            </plugin>

Dockerfile:

FROM tomcat:9.0.10-jre8-slim
ENV CATALINA_HOME /usr/local/tomcat
MAINTAINER XXX
EXPOSE 8080
ADD target/${WAR_FILE} ${CATALINA_HOME}/webapps/XXX-api.war
Alexander Sorkin
  • 634
  • 7
  • 20
Abhi.G
  • 1,801
  • 5
  • 20
  • 35

1 Answers1

2

To fix the error you should use the same parameters in two sections of your pom.xml. You didn't define the repository's name for the build goal:

<configuration>
    <repository>XXX/XXX-api</repository>
</configuration>

The fact that docker-info.jar was created in your Target directory most likely means that the creation of the docker image completed successfully.

The image should be put to your Docker registry with the name "XXX/XXX-api", and you can check it from a console with the command:

docker image ls

P.S. You can avoid generation of docker-info.jar by adding the following parameter to the configuration section of dockerfile-maven-plugin:

<configuration>
    <skipDockerInfo>true</skipDockerInfo>
</configuration>
Alexander Sorkin
  • 634
  • 7
  • 20