I am trying to build a docker image for my spring-boot application. This is my Dockerfile:
FROM ubuntu
ENV JAVA_VERSION 8u31
ENV BUILD_VERSION b13
# Upgrading system
RUN apt-get -y upgrade
RUN apt-get -y install wget
# Downloading & Config Java 8
RUN wget --no-cookies --no-check-certificate --header "Cookie:
oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-
pub/java/jdk/$JAVA_VERSION-$BUILD_VERSION/jdk-$JAVA_VERSION-linux-
x64.rpm" -O /tmp/jdk-8-linux-x64.rpm
RUN apt-get -y install /tmp/jdk-8-linux-x64.rpm
RUN alternatives -- install /usr/lib/jvm/java-8-oracle/jre/bin/java
1081
RUN alternatives --install /usr/lib/jvm/java-8-openjdk-
amd64/jre/bin/java 1081
RUN alternatives --install /usr/lib/jvm/java-8-oracle/jre/bin/java
1081
EXPOSE 8089
#install Spring Boot artifact
VOLUME /tmp
ADD /maven/sfg-thymeleaf-course-0.0.1-SNAPSHOT.jar sfg-thymeleaf-
course.jar
RUN sh -c 'touch /sfg-thymeleaf-course.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-
jar","/sfg-thymeleaf-course.jar"]
This is my pom.xml file where i have my io.fabric8 plugin there:
`<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.uipurpose</groupId>
<artifactId>detailsapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>detailsapp</name>
<description>Demo project for integrating with Angular</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>com.microsoft.sqlserver</groupId>-->
<!--<artifactId>mssql-jdbc</artifactId>-->
<!--<scope>runtime</scope>-->
<!--</dependency>-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.15.3</version>
<configuration>
<dockerHost>http://127.0.0.1:2375</dockerHost>
<verbose>true</verbose>
<images>
<image>
<name>nisharunnisa/sample-spring-boot-app</name>
<build>
<dockerFile>Dockerfile</dockerFile>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</project>`.
When I am trying to build a docker image using mvn package docker:build
i am getting an error :
Failed to execute goal io.fabric8:docker-maven-plugin:0.15.3:build (default-cli) on project detailsapp: Execution default-cli of goal io.fabric8:docker-maven-plugin:0.15.3:build failed. NullPointerException -> [Help 1]
Can Someone help with the solution, It will be grate. Thank you!