docker-maven-plugin: Error: " must have a non-null "
Description
I have define this plugin section:
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.17.2</version>
<configuration>
<images>
<image>
<alias>galan</alias>
<name>cdp/galan</name>
<external>
<type>compose</type>
<basedir>docker</basedir>
<composeFile>docker-compose.yml</composeFile>
</external>
</image>
</images>
</configuration>
</plugin>
Info
When I do:
mvn clean docker:build
I get the following error:
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.17.2:build (default-cli) on project galileo-anagrafica-rapporto-services: Execution default-cli of goal io.fabric8:docker-maven-plugin:0.17.2:build failed: Configuration error: <image> must have a non-null <name> -> [Help 1]
- d-m-p version : 0.17.2
- Maven version (
mvn -v
) :
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: it_IT, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-45-generic", arch: "amd64", family: "unix"
- Docker version :
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 16
Hi, @rhuss : i have the very same issue with the 0.20.0 version of the plugin. Any update on the source of the problem ?
Yep. Looks like I’m affected as well. I debugged plugin code a bit (turns out it’s as easy as use mvnDebug instead of mvn on the cmd line):
At least one NPE issue is here
io.fabric8.maven.docker.config.handler.compose.DockerComposeConfigHandler#getImageName
My workaround was to set pom.xml/alias to match “name” from docker-compose (for the image that requires a build and is not just pulled so it does not have “image”), then pom.xml/name would be used for that image and it can be non-null.Unfortunately in my case there were some weird issues around
<wait/>
configs, so I ended up switching to exec plugin with shell scripts calling docker-compose directly.I had a similar problem when my docker-compose.yml contained a build instruction. If I just refer to an image everything is fine…
however, I don’t understand if all the other configurations work… I tried to wait for a condition in the <run> section but with docker compose it looks like it is ignored…