title: I am trying to perform mvn install from Dockerfile but it is not working says mvn not found
body: <p>I am trying to perform &quot;mvn install&quot; to create war file from Dockerfile. Bellow is the Dockerfile</p>
  <pre><code>FROM scratch
  FROM ubuntu:16.04
  
  RUN mkdir /opt/java8
  RUN mkdir /opt/tomcat8
  RUN mkdir /opt/maven3
  
  ENV JAVA_HOME /opt/java8
  ENV CATALINA_HOME /opt/tomcat8
  
  ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin:$M2_HOME/bin
  
  ADD jdk1.8.0_112 /opt/java8
  ADD apache-tomcat-8.0.38 /opt/tomcat8
  
  WORKDIR /home/veni/git/M_UserTP
  RUN mvn install
  
  WORKDIR /home/veni/git/M_UserTP/target 
  RUN mv M_UserTP.war 
  /home/veni/Documents/dhaval_bhoot/docker_images/tomcat1
  
  ADD M_UserTP.war /opt/tomcat8/webapps
  
  EXPOSE 8080
  
  CMD [&quot;catalina.sh&quot;, &quot;run&quot;]
  </code></pre>
  <p>I also added the path of bin directory of maven in PATH environment variable.</p>
  <p>PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/veni/Documents/apache-maven-3.3.9/bin/</p>
  <p>This path I set from root user in my machine, I also added same path in PATH variable as normal user already.</p>
  <p>So now I exit from root user and come back by sudo su to be root user and check PATH variable, it has not path of maven</p>
  <h1>So when I make docker build of image I get the bellow error</h1>
  <p>/bin/sh: 1: mvn: not found
  The command '/bin/sh -c mvn install' returned a non-zero code: 127</p>