Dockerfile-maven: dockerConfigFile can't work!

Created on 8 Mar 2018  Â·  1Comment  Â·  Source: spotify/dockerfile-maven

env:

  • maven 3.5.2
  • dockerfile-maven-plugin 1.4.0
  • Docker version 17.12.0-ce, build c97c6d6

configuration in pom.xml

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>dockerfile-maven-plugin</artifactId>
    <version>1.4.0</version>
    <executions>
        <execution>
            <id>default</id>
            <goals>
                <goal>build</goal>
                <!-- <goal>push</goal> -->
            </goals>
        </execution>
    </executions>
    <configuration>
        <dockerConfigFile>../</dockerConfigFile>
        <repository>${docker.image.prefix}/${project.artifactId}</repository>
        <tag>${project.version}</tag>
        <buildArgs>
            <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
        </buildArgs>
        <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
    </configuration>
</plugin>

Dockerfile is locate at /Users/aaa/,
run these commands:

$ cd /Users/aaa/project
$ mvn dockerfile:build

error info:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- dockerfile-maven-plugin:1.4.0:build (default-cli) @ project ---
[INFO] Building Docker context /Users/aaa/project
[ERROR] Missing Dockerfile in context directory: /Users/aaa/project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.819 s
[INFO] Finished at: 2018-03-08T17:33:02+08:00
[INFO] Final Memory: 24M/327M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.0:build (default-cli) on project logger-server: Missing Dockerfile in context directory: /Users/aaa/project -> [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

Most helpful comment

dockerConfigFile is meant to be the path to the file that is at ~/.docker/config.json.

I believe you want to be configuring the contextDirectory property.

>All comments

dockerConfigFile is meant to be the path to the file that is at ~/.docker/config.json.

I believe you want to be configuring the contextDirectory property.

Was this page helpful?
0 / 5 - 0 ratings