I have the following spring-boot-maven-plugin configuration:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<host>tcp://<docker-host>:2375</host>
</docker>
<image>
<buildpacks>
<buildpack>gcr.io/paketo-buildpacks/amazon-corretto:latest</buildpack>
<buildpack>paketo-buildpacks/java</buildpack>
</buildpacks>
<verboseLogging>true</verboseLogging>
<pullPolicy>IF_NOT_PRESENT</pullPolicy>
<env>
<BP_DEBUG>true</BP_DEBUG>
</env>
<bindings>
<binding>${basedir}/bindings:/platform/bindings</binding>
</bindings>
</image>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>executable</classifier>
</configuration>
</execution>
</executions>
</plugin>
I want to pass the docker host
and bindings
as args to mvn spring-boot:build-image
I tried -Dspring-boot.build-image.dockerHost
, -Dspring-boot.build-image.docker.host
, -Dspring-boot.dockerHost
etc, however, nothing worked for me.
I am yet to try something for bindings: ${basedir}/bindings:/platform/bindings
Our requirement is to set both docker host
and bindings
as mvn spring-boot:build-image
args to keep the pom.xml
generic as far as possible.
Not sure what I am missing here?
P.S. Setting the DOCKER_HOST
as env
variable works.
Also, I can use ${docker.host}
for host and ${binding}
for bindings and then run the following command:
mvn spring-boot:build-image -Ddocker.host=mydockerhost:2375
-Dbinding="my/absolute-path/to/bindings:platform/bindings"
I guess it's not the appropriate solution.
Unfortunately, I don't think you can do better than what you already envisioned (creating your own maven pom variables to inject values into the plugin settings)
A similar issue was raised recently and the resolution was just a matter of documentation.
Back to your issue, you can see through the code or through the documentation that there is no way to configure dockerHost
nor bindings
(although as you mentioned the env variable DOCKER_HOST
is an option) via Spring properties.
Hope that helps!