简体   繁体   中英

How to solve docker OCI runtime create failed starting container process caused “exec: \”java\“: executable file not found in $PATH”:

Below is my Dockerfile-

FROM centos

ENV JAVA_HOME /home/jovyan/work/myprojects/jdk-11.0.7

ENV PATH $PATH:/home/jovyan/work/myprojects/jdk-11.0.7/bin

ADD build/libs/CatalogModel-1.0.jar CatalogModel-1.0.jar

EXPOSE 9081

ENTRYPOINT ["java", "-jar", "CatalogModel-1.0.jar"]


CatalogModel-1.0.jar is my springboot application jar file

instead of adding jdk file in Dockerfile using ADD command

Using Below command,i am creating an image

docker build -f Dockerfile -t catalogmodelimage.

i am trying to use bind mount the jdk file using below command,

docker run -p 9081:9081 --mount type=bind,source=C:/Docker/jdk-11.0.7,target=/home/jovyan/work/myprojects catalogmodelimage

But when i execute the above command,i get this error

docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"java\": executable file not found in $PATH": unknown.

在此处输入图像描述

Why do you don't use a java docker image?

FROM openjdk:11.0.7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM