skip to Main Content

I’m trying to create a multi-stage Dockerfile

FROM openjdk:11.0.7-jre-slim-buster AS build

... additional commands


RUN mkdir -p target/exploded && (cd target/exploded; jar -xf ../*.jar)

But it fails when trying to explode the .jar file, it is present under the target directory:

enter image description here

 => ERROR [build 7/7] RUN mkdir -p target/exploded && (cd
 target/exploded; jar -xf ../*.jar)
 /bin/sh: 1: jar: not found
 ------
 executor failed running [/bin/sh -c mkdir -p target/exploded && (cd target/exploded; 
 jar -xf ../*.jar)]: exit code: 127

2

Answers


  1. Chosen as BEST ANSWER

    I'm including Spring Cloud Contract as a dependency, it generates a ...stubs.jar file, causing a Docker conflict as it can't choose the proper jar to be exploded, now I'm updating the Dockerfile to target the correct .jar file.


  2. I suggest you to debug where the jar command is, in order to fully address it in your call by a:

    RUN find / -name jar
    

    The remove this line and prepend the found path to your jar invocation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search