title: Spring boot container runs locally but not on EC2
body: <p>I have a spring boot microservice in a docker container. The container runs locally just fine but it doesn't on EC2. My local Java version is 12. My local docker version is 18.06.1-ce, same as the EC2 instance docker version. </p>
  
  <p>The dockerfile is as follows</p>
  
  <pre><code>FROM openjdk:12-alpine
  VOLUME /tmp
  COPY target/my-api-0.0.1.jar /app.jar
  ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
  </code></pre>
  
  <p>when I try to run this container on EC2 I get the error:</p>
  
  <pre><code>Error: Invalid or corrupt jarfile /app.jar
  </code></pre>
  
  <p>EC2's Java version is 1.7.0_231. But I imagine that since I'm using Java 12 in my docker container the container would execute the jar inside it in a java 12 environment. </p>
  
  <p>I don't know why I'm still getting the "invalid or corrupt jar" error. </p>
  
  <p>I have done <code>mvn clean</code> and <code>mvn package</code> before building the docker container locally. </p>
  
  <p>Any help? Thanks!</p>