title: Running a Java war file deployed on Tomcat over Windows server 2016 Docker container
body: <p>Trying to run a Java .war file with Docker on Windows server 2016.</p>
  
  <p>With Linux container it can be done by pulling Tomcat image (<em>which is built on top of openJDK and uses Debian as a base image</em>) and adding war file to <em>webapps</em> folder through <strong>Dockerfile</strong>.</p>
  
  <p>But, Tomcat do not currently has any image for Windows containers, since openJDK too doesn't have support for <strong>Microsoft/windowsservercore</strong> or <strong>Microsoft/nanoserver</strong></p>
  
  <p>In my view, to be able to run war on Tomcat for windows We will need:</p>
  
  <ul>
  <li>windowsservercore</li>
  <li>JDK:JRE installation on top of windowsservercore </li>
  <li>Tomcat installation with Environment Vars of installed JDK.</li>
  </ul>
  
  <p>To create the final image JDK is downloaded and installed through PS :</p>
  
  <p>The Dockerfile looks like:</p>
  
  <pre><code>FROM windowsservercore
  
  RUN powershell (new-object System.Net.WebClient).Downloadfile('http://javadl.oracle.com/webapps/download/Au toDL?BundleId=210185', 'C:\jre-8u91-windows-x64.exe')
  RUN powershell start-process -filepath C:\jre-8u91-windows-x64.exe -passthru  -wait -argumentlist "/s,INSTALLDIR=c:\Java\jre1.8.0_91,/L,install64.log"
  RUN del C:\jre-8u91-windows-x64.exe
  
  CMD [ "c:\\Java\\jre1.8.0_91\\bin\\java.exe", "-version"]
  </code></pre>
  
  <p>But I am not sure how to install Tomcat with Environment variables set and then adding war to the webapps Directory.</p>
  
  <p>Heard about <em>WinDocks</em>, but I would like to build without it.</p>
  
  <p>Anyone has some insights on this?</p>