4

I'm getting this error when I run my Dockerfile.

[FATAL tini (7)] exec /docker-entrypoint.sh failed: No such file or directory

The docker build command runs fine but when I try to run it I get this issue.

It's not a permissions issue since I have set the full read/write permissions for the file via chmod 777 command.

Any idea what I'm missing here. Below is a snippet from my Dockerfile

ARG base_image_name=tomcat
ARG base_image_version=9-jdk11-openjdk-slim

FROM $base_image_name:$base_image_version

ARG component_exe

COPY docker-entrypoint.sh $component_exe /

ENV APP_ROOT=/usr/local/tomcat
ENV component_runtime=${APP_ROOT}/webapps/$component_exe
ENV APP_USER=uat
 
# Install all required packages and set appropriate access permissions
    RUN \
      apt-get -y update && \
      apt-get -y upgrade && \
      apt-get install jq bash ca-certificates tini && \
      adduser --disabled-password --gecos "" ${APP_USER} && \
      mkdir -p ${APP_ROOT}/temp && \
      mkdir -p ${APP_ROOT}/bin && \
      mkdir -p ${APP_ROOT}/webapps && \
      chmod 777 ${APP_ROOT}/webapps && \
      chown -R ${APP_USER}:root ${APP_ROOT} && \
      chmod 777 /docker-entrypoint.sh && \
      chmod -R g=u ${APP_ROOT} && \
      find / -name *.war && \
      find / -name *tini* && \
      find / -name *-entrypoint.sh && \
      mv /$component_exe /usr/local/tomcat/webapps && \
      chown -R :root /usr/local/openjdk-11/lib/security/cacerts && \
      chmod 660 /usr/local/openjdk-11/lib/security/cacerts
    

    EXPOSE 8080/tcp
    
    ENTRYPOINT ["/usr/bin/tini", "--", "/docker-entrypoint.sh"]
    
    # Start Tomcat Server.
    CMD ["catalina.sh", "run"]
aram063
  • 1,067
  • 13
  • 19
  • Do you `COPY` the script in (you must have, for the `chmod` to succeed)? What is its very first line? Is there a possibility the file has DOS line endings? – David Maze Oct 15 '21 at 00:45
  • 1
    Yes, I do, I have updated the code snippet to show that. – aram063 Oct 15 '21 at 00:51

2 Answers2

0

I had this problem because it my docker-entrypoint.sh was not at the path specified. Make sure your docker-entrypoint.sh is located at the path specified in the docker file. Check this by using the docker inspect command.

aram063
  • 1,067
  • 13
  • 19
0

Could you try to run the following in your Docker file folder, and build again? the reason could be you're building on Windows,

find . -not \( -name .svn -prune -o -name .git -prune \) -type f -print0 | xargs -0 sed -i 's/\r//'
SebastianX
  • 142
  • 1
  • 5