I’m learning Docker and I’m trying to create an Image of my current Spring project.
I’m trying to run mvn spring-boot:build-image
to create a docker image for my Spring Boot project, but I got this error when I execute it :
Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.7.0:build-image (default-cli) on project dwh-webservices: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.7.0:build
-image failed: Builder lifecycle 'creator' failed with status code 51
I didn’t find anything similar on the web, so I’m asking the question here.
Here is my pom.xml
. If you need more, feel free to ask.
<?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 https://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.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.business</groupId>
<artifactId>dwh-webservices</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>DWH_WebServices</name>
<description>DWH_WebServices</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.25.0-GA</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.2.jre8</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.0.1-jre</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Am I doing something wrong ? Am I missing something ?
4
Answers
try by inserting this jar in your application :
https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.10.0/spring-cloud-bindings-1.10.0.jar
you are probably missing some dependencies,
Locate the dependencies you’re missing, then install them manually, and build your project
add this dependency
also, add this jar file jar file
RightClick on your project > Maven > Reload project
I hope this will work, you can ping me any time
I had the same issue a few days ago.
The problem was that my company is rewriting the TSL certificate, so I was unable to download it :
I had to add it manually. I follow this and it worked.
Hope it helps.
I am not an expert but following a course, I have encountered kind of the same problem as yours.
I managed to create the docker image by adding this to the pom.xml: