2

I am trying to deploy my spring boot application on a docker. I have created a docker file as follows.

FROM registry.gitlab.com/client/micro/micro-services/baseimage/database-baseimage/tmo-main:database-baseimage-1.0.1f28a87b

ADD  ./target/*.jar app.jar
ENV TZ=America/Los_Angeles
ENTRYPOINT ["java","-XX:+UnlockExperimentalVMOptions","-XX:+UseContainerSupport","-XX:MaxRAMFraction=1","-XX:+UseG1GC","-jar","app.jar"]
EXPOSE 8080

The docker file builds fine but when I run the image it throws the following error:

OpenJDK 64-Bit Server VM warning: Option MaxRAMFraction was deprecated in version 10.0 and will likely be removed in a future release.
no main manifest attribute, in app.jar

Please note that my application runs on JDK 11, maven build and already added dependency for spring-boot-maven-plugin. I couldn't find a proper solution for this query on internet. Hence requesting for the reason for this error and solution.

Abhiram S
  • 94
  • 1
  • 12
  • Does this answer your question? [Can't execute jar- file: "no main manifest attribute"](https://stackoverflow.com/questions/9689793/cant-execute-jar-file-no-main-manifest-attribute) – vaibhavsahu Sep 16 '21 at 06:24

1 Answers1

1

Resolved this issue by setting execution goals as 'repackage' in spring-boot-maven-plugin.

<plugin> 
 <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-maven-plugin</artifactId> 
 <executions> 
  <execution> 
   <goals> 
    <goal>repackage</goal> 
   </goals> 
  </execution> 
 </executions> 
</plugin>
Abhiram S
  • 94
  • 1
  • 12