I'm using Docker Compose to create a container for a Spring Boot application.
I'm receiving the following errors when I do docker-compose up
:
Recreating backend_springboot ... error
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
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
My structure:
├── docker-compose.yml
├── spring-boot
│ ├── Dockerfile
│ ├── application.properties
│ └── backofficeservices-0.0.1.jar
docker-compose.yml
version: '3'
services:
service:
container_name: backend_springboot
build: ./spring-boot
ports:
- "80:8080"
restart: always
spring-boot/Dockerfile
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
As far as I know, the application.properties
is not found. I will appreciate any help to detect my error.
My goal is to run my Spring Boot app applying the application.properties
I have there.