title: How to deal with Error: Unable to access jarfile - docker
body: <p>I'm new to docker and I struggle with <strong>&quot;Error: Unable to access jar file target/nbd.jar&quot;</strong>. My application is a CRUD api for cassandra cluster made with Springboot. I'm trying to execute <code>docker-compose up</code>. Every cassandra node is running, I only have problem with my API. I think the problem is with the Dockerfile, but I don't know how to solve it myself/ Tried different things but none of them worked.</p>
  <p>Here's my Dockerfile:</p>
  <pre><code>FROM maven:3.6.0-jdk-11-slim 
  ARG JAR_FILE
  COPY target/${JAR_FILE} target/nbd.jar
  ENTRYPOINT [&quot;java&quot;,&quot;-jar&quot;,&quot;nbd.jar&quot;]
  </code></pre>
  <p>My filesystem (I cut everything but docker and target files):</p>
  <pre><code>├── docker
  │   ├── docker-compose.yaml
  │   └── Dockerfile
  (...)
  ├── src
  │   ├── (...)                 
  ├── stop_all.sh
  └── target
      ├── classes
      │   (...)
      ├── generated-sources
      │   └── annotations
      ├── generated-test-sources
      │   └── test-annotations
      ├── nbd.jar
      └── test-classes
  </code></pre>
  <p>And my pom.xml:</p>
  <pre><code>    &lt;properties&gt;
          &lt;java.version&gt;11&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;6.0.16.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
              &lt;version&gt;2.1.4.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;version&gt;1.18.6&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
              &lt;artifactId&gt;gson&lt;/artifactId&gt;
              &lt;version&gt;2.8.5&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-cassandra&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
      
     (...)
  
  &lt;/project&gt;
  
  </code></pre>
  <p>Thanks!</p>