<p>I have a <strong>multistage</strong> <code>dockerfile</code> which I'm deploying in k8s with script as <code>ENTRYPOINT [&quot;./entrypoint.sh&quot;]</code>.</p>
<p>Deployment is done though helm and env is Azure.
While creating the container it errors out <strong>&quot;./entrypoint.sh&quot;: permission denied: unknown</strong></p>
<pre><code>Warning  Failed     14s (x3 over 31s)  kubelet            Error: failed to create containerd task: OCI runtime create failed: container_linux.go:380: starting container process caused:
exec: &quot;./entrypoint.sh&quot;: permission denied: unknown
Warning  BackOff    1s (x4 over 30s)   kubelet            Back-off restarting failed container
</code></pre>
<p>I have given <code>chmod +x</code> to make it executable and <code>chmod 755</code> for permission.</p>
<p><strong>Dockerfile</strong></p>
<pre><code>##############
##   Build   #
##############
FROM repo.azurecr.io/maven:3.8.1-jdk-11 AS BUILD
ARG WORKDIR=/opt/work

COPY . $WORKDIR/
WORKDIR ${WORKDIR}

COPY ./settings.xml /root/.m2/settings.xml

RUN --mount=type=cache,target=/root/.m2/repository \
    mvn clean package -pl app -am

RUN rm /root/.m2/settings.xml
RUN rm ./settings.xml

#################
###   Runtime   #
#################
FROM repo.azurecr.io/openjdk:11-jre-slim as RUNTIME
RUN mkdir /opt/app \
    &amp;&amp; useradd -ms /bin/bash javauser \
    &amp;&amp; chown -R javauser:javauser /opt/app \
    &amp;&amp; apt-get update \
    &amp;&amp; apt-get install curl -y \
    &amp;&amp; rm -rf /var/lib/apt/lists/*

COPY --from=BUILD /opt/work/app/target/*.jar /opt/app/service.jar
COPY --from=BUILD /opt/work/entrypoint.sh /opt/app/entrypoint.sh

RUN chmod +x /opt/app/entrypoint.sh
RUN chmod 755 /opt/app/entrypoint.sh

WORKDIR /opt/app
USER javauser

ENTRYPOINT [&quot;./entrypoint.sh&quot;]

</code></pre>
<p>PS: Please don't make it duplicate of <a href="https://stackoverflow.com/a/46353378/2226710">https://stackoverflow.com/a/46353378/2226710</a> as i have added <code>RUN chmod +x entrypoint.sh</code> and it didn't solved the issue.</p>

Raushan
<p>Use <code>bash</code> (or your preferred shell if not <code>bash</code>) in the entrypoint:</p>
<pre><code>ENTRYPOINT [ &quot;bash&quot;, &quot;-c&quot;, &quot;./entrypoint.sh&quot; ]
</code></pre>
<p>This will run the entrypoint script even if you haven't set the script as executable (which I see you have)</p>
<p>You an also use this similarly with other scripts, for example with Python:</p>
<pre><code>ENTRYPOINT [ &quot;python&quot;, &quot;./entrypoint.py&quot; ]
</code></pre>
<p>You could also try calling the script with full executable path:</p>
<pre><code>ENTRYPOINT [ &quot;/opt/app/entrypoint.sh&quot; ]
</code></pre>
