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:
=> 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
CodePudding user response:
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.
CodePudding user response:
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.