Hello @all,
i am new to docker.
while i am running my docker file getting below error:
=> ERROR [6/6] RUN mvn -f /myapp/pom.xml clean package -DskipTests 5.2s
------
[6/6] RUN mvn -f /myapp/pom.xml clean package -DskipTests:
3.675 [INFO] Scanning for projects...
4.102 Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.4.3/spring-boot-starter-parent-2.4.3.pom
5.148 [ERROR] [ERROR] Some problems were encountered while processing the POMs:
5.148 [FATAL] Non-resolvable parent POM for com.docker.example:DockerDemo:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.4.3 from/to central
5.149 [ERROR] The build could not read 1 project -> [Help 1]
5.150 [ERROR]
Below is my Dockerfile instructions
FROM openjdk
WORKDIR /myapp
COPY . /myapp
COPY pom.xml .
COPY src ./src
RUN mvn --version
RUN mvn clean install -e
#RUN apt-get update && apt-get install maven -y
RUN mvn -f /myapp/pom.xml clean package -DskipTests
#COPY myapp/target/DockerDemo-0.0.1-SNAPSHOT.jar /myapp-service/DockerDemo-0.0.1-SNAPSHOT.jar
#WORKDIR /myapp-service
#RUN javac DockerDemo.java
#COPY DockerDemo-0.0.1-SNAPSHOT.jar /usr/src/myapp/DockerDemo-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java", "-jar", "target/DockerDemo-0.0.1-SNAPSHOT.jar"]
EXPOSE 8084
below is my pom file
<?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.4.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.docker.example</groupId>
<artifactId>DockerDemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>DockerDemo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</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>
</plugins>
</build>
</project>
Kindly suggest. Thank you in advance!