Use of docker tomcat with external WAR
<p>I have been looking into best practices for tomcat on docker and how to link a WAR file.</p>

<p>The two approaches that have come across are:</p>

<ol>
<li>Extending the base tomcat image and copying the WAR file into <code>/webapps</code>, then rebuilding the image as your own.</li>
<li>Use two containers, the first bare tomcat and the second a data container such as busybox which container the WAR file. You would then mount the busybox container on the tomcat container at <code>/webapps</code> and the WAR file would be effectively picked up.</li>
</ol>

<p>I like the sound of the second approach, however I have been unable to successfully get this to work. </p>

<p>I have attempted to create a data container using busybox and then use docker compose to start the services. The WAR does not get copied and the busybox container stops immediately.</p>

<p><strong>Data Container Dockerfile:</strong></p>

<pre><code>FROM busybox

RUN mkdir /webapps
COPY ./demo.war /webapps/demo.war

VOLUME ['/webapps']
</code></pre>

<p><strong>docker-compose.yml</strong></p>

<pre><code>version: '2'
services:
  data:
    image: &lt;Data Container Image&gt;

  tomcat:
    image: tomcat:8.5.4-jre8
    volumes_from:
      - data
    ports:
      - "678:8080"
</code></pre>

<p>The WAR file is not copied over and the busybox container exits immediately after <code>docker-compose up</code> is run.</p>

<p>Any assistance would be appreciated.</p>