title: Docker: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"java\": executable file not found in $PATH"
body: <p>I have a Java Spring Boot app which works with a Postgres database. I want to use Docker for both of them. Initially, I created a docker-compose.yml file as given below:</p>
  
  <pre><code>version: '3.2'
  services:
    postgres:
      restart: always
      container_name: sample_db
      image: postgres:10.4
      ports:
        - '5432:5432'
      environment:
           - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
           - POSTGRES_USER=${POSTGRES_USER}
           - POSTGRES_DB=${POSTGRES_DB}
  # APP**
    web:
      build: .
      environment:
        SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/test
      expose:
        - '8080'
      ports:
        - '8080:8080'
  </code></pre>
  
  <p>Then,inside the application.properties file I defined the following properties.</p>
  
  <pre><code>server.port=8080
  spring.jpa.generate-ddl=true
  
  
  spring.datasource.url=jdbc:postgresql://postgres:5432/test
  spring.datasource.driver-class-name=org.postgresql.Driver
  spring.datasource.username=root
  spring.datasource.password=root
  spring.flyway.baseline-on-migrate=true
  spring.flyway.enabled=true
  
  # The SQL dialect makes Hibernate generate better SQL for the chosen database
  spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
  
  # Hibernate ddl auto (create, create-drop, validate, update)
  spring.jpa.hibernate.ddl-auto = validate
  spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults: true
  </code></pre>
  
  <p>Also,I created a Dockerfile in my project directory, which looks like this:</p>
  
  <pre><code>FROM openjdk:8-jdk-alpine
  VOLUME /tmp
  EXPOSE 8080
  RUN mkdir -p /app/
  RUN mkdir -p /app/logs/
  COPY target/household-0.0.1-SNAPSHOT.jar /app/app.jar
  FROM postgres
  ENV POSTGRES_PASSWORD postgres
  ENV POSTGRES_DB testdb
  COPY schema.sql /docker-entrypoint-initdb.d/
  ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app/app.jar"]
  </code></pre>
  
  <p>I issued these commands and ended up in the error as given below.</p>
  
  <p><strong>mvn clean package
  docker build ./ -t springbootapp<br>
  docker-compose up</strong></p>
  
  <pre><code>ERROR: for household-appliances_web_1  Cannot start service web: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"java\": executable file not found in $PATH": unknown
  
  ERROR: for web  Cannot start service web: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"java\": executable file not found in $PATH": unknown
  ERROR: Encountered errors while bringing up the project.
  </code></pre>
  
  <p><strong>Kindly anyone help on this!</strong></p>