title: No such file while indicating application properties using Dockerfile for a Spring Boot jar
body: <p>I'm using Docker Compose to create a container for a Spring Boot application.</p>
  
  <p>I'm receiving the following errors when I do <code>docker-compose up</code>:</p>
  
  <blockquote>
    <p>Recreating backend_springboot ... error</p>
    
    <p>ERROR: for backend_springboot  Cannot start service service: OCI
    runtime create failed: container_linux.go:346: starting container
    process caused "exec: \"sh -c java
    -Dspring.config.location=/application.properties -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar /app.jar\": stat sh -c java -Dspring.config.location=/application.properties
    -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar /app.jar: no such file or directory": unknown</p>
    
    <p>ERROR: for service  Cannot start service service: OCI runtime create
    failed: container_linux.go:346: starting container process caused
    "exec: \"sh -c java -Dspring.config.location=/application.properties
    -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar /app.jar\": stat sh -c java -Dspring.config.location=/application.properties
    -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar /app.jar: no such file or directory": unknown</p>
  </blockquote>
  
  <p>My structure:</p>
  
  <pre><code>├── docker-compose.yml
  ├── spring-boot
  │   ├── Dockerfile
  │   ├── application.properties
  │   └── backofficeservices-0.0.1.jar
  </code></pre>
  
  <p>docker-compose.yml</p>
  
  <pre><code>version: '3'
  services:
    service:
      container_name: backend_springboot
      build: ./spring-boot
      ports:
        - "80:8080"
      restart: always
  </code></pre>
  
  <p>spring-boot/Dockerfile</p>
  
  <pre><code>FROM openjdk:8-jre-alpine as gradle
  
  COPY backofficeservices-0.0.1.jar /app.jar
  
  COPY application.properties /application.properties
  
  ENV JAVA_OPTS=""
  
  ENTRYPOINT ["sh -c java -Dspring.config.location=/application.properties -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar /app.jar"]
  
  EXPOSE 8080
  </code></pre>
  
  <p>As far as I know, the <code>application.properties</code> is not found. I will appreciate any help to detect my error.</p>
  
  <p>My goal is to run my Spring Boot app applying the <code>application.properties</code> I have there.</p>