<p>I am trying to deploy a docker container via Kubernetes. In my DockerFile, I specify this (neuro:</p>
<pre><code>FROM docker/psh-base-centos-tomcat:7.7.1908.1
RUN groupadd -r mygroup &amp;&amp; useradd --no-log-init -r -g mygroup mygroup
USER mygroup:mygroup
WORKDIR /home/mygroup
RUN chmod 755 -R /tomcat
RUN chown -R mygroup:mygroup /tomcat
COPY ./target/rest-*.war /tomcat/webapps/rest.war
ENTRYPOINT [&quot;sh&quot;, &quot;/tomcat/bin/startup.sh&quot;]
</code></pre>
<p>However, when I deploy this service via AKS, logs say this:</p>
<pre><code>sh: /tomcat/bin/catalina.sh: Permission denied
</code></pre>
<p>I manually enabled permission of <code>catalina.sh</code> file specifically by adding <code>RUN chmod 755 -R /tomcat/bin/catalina.sh</code> to DockerFile, then I re-deployed it and now I get this:</p>
<pre><code>touch: cannot touch '/tomcat/logs/catalina.out': Permission denied
/tomcat/bin/catalina.sh: line 434: /tomcat/logs/catalina.out: Permission denied
</code></pre>
<p>It seems like <code>RUN chmod 755 -R /tomcat</code> is not working correctly, and I have no idea why. Is there anything I am doing wrong here to get permission for <code>/tomcat</code> folder?</p>

Jonathan Hagen
<p>it's a Linux users management issue in your Dockerfile, Dockerfiles are interpreted line by line in the build process (layer per layer) in your case you have set the &quot;neurostar&quot; as a current user in the third line and you want to change  the default user directories access permissions.</p>
<p>This should work for you :</p>
<pre><code>FROM docker/psh-base-centos-tomcat:7.7.1908.1 
USER root 
RUN groupadd -r mygroup &amp;&amp; useradd --no-log-init -r -g mygroup mygroup 
RUN chmod 755 -R /tomcat 
RUN chown -R mygroup:mygroup /tomcat 
USER mygroup 
COPY ./target/rest-*.war /tomcat/webapps/rest.war 
ENTRYPOINT [&quot;sh&quot;, &quot;/tomcat/bin/startup.sh&quot;]
</code></pre>
