title: How can I run a .jar on Tomcat container?
body: <p>I'm new with docker, what I'm trying to run <code>maven-wrapper.jar</code> file in tomcat:8.0-alpine container.
  I follow some steps in the following website <a href="https://medium.com/@pra4mesh/deploy-war-in-docker-tomcat-container-b52a3baea448" rel="nofollow noreferrer">https://medium.com/@pra4mesh/deploy-war-in-docker-tomcat-container-b52a3baea448</a>
  the difference is that it uses .war while I'm using the .jar file.
  I do not know if this information is useful for you but the project auto-generation using  <a href="https://start.spring.io/" rel="nofollow noreferrer">https://start.spring.io/</a>.</p>
  <p>here is my Dockerfile to build an image (to be honest I do not know what is call Dockerfile or something else).</p>
  <pre><code>FROM tomcat:8.0-alpine
  
  LABEL maintainer=&quot;deepak@softwareyoga.com&quot;
  
  ADD maven-wrapper.jar /usr/local/tomcat/webapps/
  
  EXPOSE 8080
  
  CMD [&quot;catalina.sh&quot;, &quot;run&quot;]
  </code></pre>
  <p>Note that when I build the image using the command:</p>
  <pre><code>\Desktop\try&gt;docker build .
  Sending build context to Docker daemon  53.76kB
  Step 1/5 : FROM tomcat:8.0-alpine
  8.0-alpine: Pulling from library/tomcat
  4fe2ade4980c: Already exists
  6fc58a8d4ae4: Already exists
  7d9bd64c803b: Already exists
  a22aedc5ac11: Already exists
  5bde63ae3587: Already exists
  69cb0c9b940a: Already exists
  Digest: sha256:d02a16c0147fcae13d812fa670a4b3c9944f5328b10a5a463ad697d2aa5bb063
  Status: Downloaded newer image for tomcat:8.0-alpine
   ---&gt; 624fb61775c3
  Step 2/5 : LABEL maintainer=&quot;deepak@softwareyoga.com&quot;
   ---&gt; Running in 1d725bda89d9
  Removing intermediate container 1d725bda89d9
   ---&gt; 11b904dae739
  Step 3/5 : ADD maven-wrapper.jar /usr/local/tomcat/webapps/
   ---&gt; ed694b383b75
  Step 4/5 : EXPOSE 8080
   ---&gt; Running in 2dc19f215bc7
  Removing intermediate container 2dc19f215bc7
   ---&gt; 59981a644862
  Step 5/5 : CMD [&quot;catalina.sh&quot;, &quot;run&quot;]
   ---&gt; Running in 08f6b5d8d632
  Removing intermediate container 08f6b5d8d632
   ---&gt; c8576389fd76
  Successfully built c8576389fd76
  SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double-check and reset permissions for sensitive files and directories.
  </code></pre>
  <p>&quot;Successfully built&quot; it work and produce the image</p>
  <pre><code></code></pre>
  <p>\Desktop\try&gt;docker images
  REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
                              c8576389fd76        6 minutes ago       147MB
  tomcat              8.0-alpine          624fb61775c3        14 months ago       147MB</p>
  <pre><code>my jar file name maven-wrapper.jar 
  and exist in same folder with Dockerfile
  &gt;Desktop\try&gt;dir
  11/08/2019  10:33 PM    &lt;DIR&gt;          .
  11/08/2019  10:33 PM    &lt;DIR&gt;          ..
  11/08/2019  11:24 PM               301 Dockerfile
  11/08/2019  05:27 PM            50,710 maven-wrapper.jar
                 2 File(s)         51,011 bytes
                 2 Dir(s)  269,240,381,440 bytes free 
  
  \Desktop\try&gt;docker container run -it --publish 8081:8080 c8576389fd76
  Using CATALINA_BASE:   /usr/local/tomcat
  Using CATALINA_HOME:   /usr/local/tomcat
  Using CATALINA_TMPDIR: /usr/local/tomcat/temp
  Using JRE_HOME:        /usr/lib/jvm/java-1.7-openjdk/jre
  Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
  08-Nov-2019 21:52:57.955 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.53
  08-Nov-2019 21:52:57.958 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jun 29 2018 14:42:45 UTC
  08-Nov-2019 21:52:57.959 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.53.0
  08-Nov-2019 21:52:57.962 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
  08-Nov-2019 21:52:57.964 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            4.9.184-linuxkit
  08-Nov-2019 21:52:57.965 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
  08-Nov-2019 21:52:57.966 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-1.7-openjdk/jre
  08-Nov-2019 21:52:57.966 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.7.0_181-b01
  08-Nov-2019 21:52:57.967 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
  08-Nov-2019 21:52:57.967 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /usr/local/tomcat
  08-Nov-2019 21:52:57.968 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/local/tomcat
  08-Nov-2019 21:52:57.969 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
  08-Nov-2019 21:52:57.970 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
  08-Nov-2019 21:52:57.971 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
  08-Nov-2019 21:52:57.976 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
  08-Nov-2019 21:52:57.979 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
  08-Nov-2019 21:52:57.981 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
  08-Nov-2019 21:52:57.983 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
  08-Nov-2019 21:52:57.983 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
  08-Nov-2019 21:52:57.984 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.17 using APR version 1.6.3.
  08-Nov-2019 21:52:57.985 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
  08-Nov-2019 21:52:57.991 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2o  27 Mar 2018)
  08-Nov-2019 21:52:58.082 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [&quot;http-apr-8080&quot;]
  08-Nov-2019 21:52:58.092 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [&quot;ajp-apr-8009&quot;]
  08-Nov-2019 21:52:58.095 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 766 ms
  08-Nov-2019 21:52:58.127 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
  08-Nov-2019 21:52:58.127 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.53
  08-Nov-2019 21:52:58.151 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/manager
  08-Nov-2019 21:52:58.907 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/manager has finished in 756 ms
  08-Nov-2019 21:52:58.908 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/host-manager
  08-Nov-2019 21:52:59.001 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/host-manager has finished in 93 ms
  08-Nov-2019 21:52:59.002 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/examples
  08-Nov-2019 21:52:59.427 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/examples has finished in 425 ms
  08-Nov-2019 21:52:59.428 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/ROOT
  08-Nov-2019 21:52:59.455 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/ROOT has finished in 27 ms
  08-Nov-2019 21:52:59.456 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/docs
  08-Nov-2019 21:52:59.482 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/docs has finished in 26 ms
  08-Nov-2019 21:52:59.489 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [&quot;http-apr-8080&quot;]
  08-Nov-2019 21:52:59.504 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [&quot;ajp-apr-8009&quot;]
  08-Nov-2019 21:52:59.509 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1413 ms
  </code></pre>
  <p>Go to http://localhost:8081
  showed me a tomcat server default page
  I try http://localhost:8081/maven-wrapper
  &quot;HTTP Status 404 – Not Found
  any help ?!!</p>