-
Notifications
You must be signed in to change notification settings - Fork 652
Closed
Labels
Description
Description
Build arg regression with 0.44.0, possibly from #1731
Caused by: com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonArray
at com.google.gson.internal.bind.TypeAdapters$33$1.read (TypeAdapters.java:869)
at com.google.gson.Gson.fromJson (Gson.java:963)
at com.google.gson.Gson.fromJson (Gson.java:928)
at com.google.gson.Gson.fromJson (Gson.java:877)
at com.google.gson.Gson.fromJson (Gson.java:848)
at io.fabric8.maven.docker.util.JsonFactory.newJsonObject (JsonFactory.java:18)
at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.getImageId (DockerAccessWithHcClient.java:478)
at io.fabric8.maven.docker.service.QueryService.getImageId (QueryService.java:135)
at io.fabric8.maven.docker.service.BuildService.autoPullBaseImage (BuildService.java:385)
at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:69)
at io.fabric8.maven.docker.BuildMojo.proceedWithDockerBuild (BuildMojo.java:106)
at io.fabric8.maven.docker.BuildMojo.proceedWithBuildProcess (BuildMojo.java:89)
at io.fabric8.maven.docker.BuildMojo.buildAndTag (BuildMojo.java:82)
at io.fabric8.maven.docker.BuildMojo.processImageConfig (BuildMojo.java:159)
at io.fabric8.maven.docker.BuildMojo.executeInternal (BuildMojo.java:71)
at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:295)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
Info
-
docker-maven-plugin version : 0.44.0
-
Maven version (
mvn -v
) : 3.9.6 -
Docker version : Docker version 24.0.7-rd, build 72ffacf
-
If it's a bug, how to reproduce :
Have a dockerfile that uses a build arg for the FROM image.
ARG FROM_IMAGE
FROM ${FROM_IMAGE} AS jlink
Flex that build arg via the plugin configuration stanzas.
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>myimage:21</name>
<build>
<args>
<FROM_IMAGE>openjdk:21</FROM_IMAGE>
</args>
</build>
</image>
<image>
<name>myimage:17</name>
<build>
<args>
<FROM_IMAGE>openjdk:17</FROM_IMAGE>
</args>
</build>
</image>
</images>
</configuration>
</plugin>
Partial Workaround
Running the build with mvn package -DFROM_IMAGE=openjdk:21
works, but is only a viable workaround when building a single image for the entire build.
ggjulio