I am trying to dockerize a spring boot service. I started referring to this article. I was able to build the image but could not run it. When i try to run the container it fails with below error.
OCI runtime create failed: container_linux.go:345: starting container process caused \"exec: \\"catalina.sh\\": executable file not found in $PATH\": unknown
Command used to build image : docker build --tag=my-image . --no-cache Command used to run container : docker container run -p 8080:8080 my-image
Docker File:
FROM openjdk:8-jdk-alpine
COPY ./target/my-service.war /usr/local/tomcat/webapps/my-service.war
CMD ["catalina.sh","run"]
I am using Windows 10 Docker Desktop and I tried using other base images, reset docker but none of it solve the problem. Please help me with some suggestions.
Regards, Jai
catalina.sh is from tomcat.
From the article you mentioned in the post, it told you to use:
From tomcat:8.0.51-jre8-alpine
CMD ["catalina.sh","run"]
But, you now use:
FROM openjdk:8-jdk-alpine
CMD ["catalina.sh","run"]
The base image you used do not have tomcat installed, so you certainly could not find catalina.sh.
use following command to find catalina.sh
1.docker run -it --rm (ur_image_name) /bin/bash 2./usr/local/tomcat/bin 3.ls
It will list out all file in bin directory.There you will see catalina.sh. Now Copy the whole path of catalina.sh like in my case it is "\usr\local\tomcat\bin\catlina.sh"
and paste this in DockerFile in CMD like this CMD ["\usr\local\tomcat\bin\catlina.sh","run"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With