단서해
개발일지
단서해
전체 방문자
오늘
어제
  • 분류 전체보기 (29)
    • Project (5)
    • JAVA (2)
    • Server (11)
      • Info (4)
      • 작동 원리 예상 (4)
      • Question (1)
      • JPA (1)
    • Infra (2)
    • Trouble Shooting (8)

블로그 메뉴

  • 홈
  • 글쓰기
  • 관리

공지사항

인기 글

태그

  • Reflection
  • Lettuce
  • thymeleaf
  • 분산락
  • @Component scan
  • gradlew
  • 파일 경로
  • OAuth2.0
  • 무중단 배포
  • 비동기
  • REQUIRES_NEW
  • enhanced for
  • CodeDeploy
  • Fileter
  • docker
  • @configuration
  • JPA
  • pinpoint
  • gradle-wrapper.properties
  • gradle
  • flutter
  • Github Actions
  • 트랜잭션
  • Intellij
  • Spring
  • Java
  • error
  • 성능 개선
  • yml
  • 동시성

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
단서해

개발일지

Trouble Shooting

[Docker] Error: Invalid or corrupt jarfile /app.jar

2022. 11. 1. 00:19

문제 발생


Docker 를 docker-compose up 을 통해 실행하려 하던 중, 위와 같은 오류가 발생하며 컨테이너 실행이 되지 않았다.

 

원인 및 해결


FROM openjdk:11-jdk
ARG JAR_FILE=./build/libs/*.jar
COPY ${JAR_FILE} app.jar/
ENTRYPOINT [ "java", "-jar", "/app.jar" ]

ec2 환경에서 아래와 같이 app.jar 로 작성할 경우 /를 붙이라는 오류가 나왔기에 /를 추가해서 실행하려 했다.

COPY ${JAR_FILE} app.jar/

이 부분에서 문제가 생긴 것 이었고, app.jar/ 에서 /를 제거한 뒤에 두 개 생성되어있던 JAR_FILE(*-plain.jar, *.jar)  중에 *.jar 파일로 빌드파일을 지정해주었다.

ARG JAR_FILE=./build/libs/example.jar

이후 더이상 에러가 발생하지 않고 컨테이너가 정상적으로 실행되었다.

 

 

 

 

 

저작자표시 (새창열림)

'Trouble Shooting' 카테고리의 다른 글

[Spring] yml 로 DB 연결 시 주의사항 - Access denied for user 'name'@'server' (using password: YES)  (0) 2022.10.03
[Github Actions] Error: Gradle script '/home/runner/work/@@@/@@@/gradlew' is not executable.  (0) 2022.09.18
[Github Actions] Error: Cannot locate a Gradle wrapper properties file at '/home/runner/work/@@@/@@@/gradle/wrapper/gradle-wrapper.properties'. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured. 에러.  (0) 2022.09.18
[Spring] JPA 로 Table 생성시 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near... 예외  (0) 2022.09.15
[Github Actions] Error Gradle Script ‘/Home/Runner/Work/*/Gradlew’ Is Not Executable 발생.  (0) 2022.08.17
    'Trouble Shooting' 카테고리의 다른 글
    • [Spring] yml 로 DB 연결 시 주의사항 - Access denied for user 'name'@'server' (using password: YES)
    • [Github Actions] Error: Gradle script '/home/runner/work/@@@/@@@/gradlew' is not executable.
    • [Github Actions] Error: Cannot locate a Gradle wrapper properties file at '/home/runner/work/@@@/@@@/gradle/wrapper/gradle-wrapper.properties'. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured. 에러.
    • [Spring] JPA 로 Table 생성시 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near... 예외
    단서해
    단서해

    티스토리툴바