We are using io.fabric8:docker-maven-plugin:0.27.2
to build our docker images.
Just wondering how to pass rm
into buildoptions? I want to clear all the intermediate (<none>) images after successfully building them - using the mvn docker:build
command
REPOSITORY TAG IMAGE ID CREATED SIZE
myproject/baseimage latest baa18e544738 3 days ago 1.53GB
<none> <none> c98ecb5bc381 3 days ago 784MB
<none> <none> 14d3f81c4bc0 4 days ago 533MB
<none> <none> 9b07174fc67a 4 days ago 532MB
I tried to pass something like this.
<buildoptions>
<rm>true</rm>
</buildoptions>
equivalent of:
docker build --rm -f Dockerfile -t myproject/baseImage:latest .
The documentation is not very clear -> http://dmp.fabric8.io/#build-configuration
Full Configuration of pom.xml:
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.27.2</version>
<extensions>true</extensions>
<configuration>
<verbose>true</verbose>
<images>
<image>
<name>myproject/baseimage</name>
<build>
<tags>
<tag>latest</tag>
</tags>
<dockerFile>${project.basedir}/Dockerfile</dockerFile>
<buildOptions>
<rm>true</rm>
</buildOptions>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker:build</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I tried a bunch of things including passing the same variable in maven properties. But nothing worked.
<docker.buildoptions.rm>true</docker.buildoptions.rm>
Any help is greatly appreciated!