Sorry, the image you used was alpine so it does not have bash installed.
But you could of brought up a sh prompt like this:
docker run -p 4001:8080 newpetclinic sh
And then looked around.
So I built an image with your Dockerfile and ran it and debugged it for you.
Your CMD statement is wrong in your Dockerfile.
Example
🐳 gforghetti:[~/Downloads/test] $ docker container run -it test
/bin/sh: [“java: not found
Your CMD in your Dockerfile:
CMD [“java -jar spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar”]
Should be this:
CMD ["java", "-jar", "spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar"]`
I fixed the CMD and re-built and it works.
🐳 gforghetti:[~/Downloads/test] $ cat Dockerfile
FROM alpine/git as clone
WORKDIR /app
RUN git clone https://github.com/spring-projects/spring-petclinic.git
FROM maven:3.5-jdk-8-alpine as build
WORKDIR /app
COPY --from=clone /app/spring-petclinic /app
RUN mvn install
FROM openjdk:8-jre-alpine
WORKDIR /app
COPY --from=build /app/target/spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar /app
CMD ["java", "-jar", "spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar"]
🐳 gforghetti:[~/Downloads/test] $ docker image build -t test .
Sending build context to Docker daemon 2.048kB
Step 1/11 : FROM alpine/git as clone
---> 1e76d5809b62
Step 2/11 : WORKDIR /app
---> Using cache
---> 31a17ad44e97
Step 3/11 : RUN git clone https://github.com/spring-projects/spring-petclinic.git
---> Using cache
---> 73a7dd24aa99
Step 4/11 : FROM maven:3.5-jdk-8-alpine as build
---> fb4bb0d89941
Step 5/11 : WORKDIR /app
---> Using cache
---> bd92b58e5f54
Step 6/11 : COPY --from=clone /app/spring-petclinic /app
---> Using cache
---> 4a5c09890416
Step 7/11 : RUN mvn install
---> Using cache
---> 1d8a8cfc88c5
Step 8/11 : FROM openjdk:8-jre-alpine
---> 1b46cc2ba839
Step 9/11 : WORKDIR /app
---> Using cache
---> 228f42c954c3
Step 10/11 : COPY --from=build /app/target/spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar /app
---> Using cache
---> 8cc1fe8b2136
Step 11/11 : CMD ["java", "-jar", "spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar"]
---> Running in da807f9680e3
Removing intermediate container da807f9680e3
---> 41209a3c5587
Successfully built 41209a3c5587
Successfully tagged test:latest
🐳 gforghetti:[~/Downloads/test] $ docker container run -it test
|\ _,,,--,,_
/,`.-'`' ._ \-;;,_
_______ __|,4- ) )_ .;.(__`'-'__ ___ __ _ ___ _______
| | '---''(_/._)-'(_\_) | | | | | | | | |
| _ | ___|_ _| | | | | |_| | | | __ _ _
| |_| | |___ | | | | | | | | | | \ \ \ \
| ___| ___| | | | _| |___| | _ | | _| \ \ \ \
| | | |___ | | | |_| | | | | | | |_ ) ) ) )
|___| |_______| |___| |_______|_______|___|_| |__|___|_______| / / / /
==================================================================/_/_/_/
:: Built with Spring Boot :: 2.1.2.RELEASE