0

I've created an image in docker and having /app/run.sh: line 7: java: command not found while trying to run this using sudo docker run com.project.question/question:1.0.0 .Here's my run.sh

#!/bin/bash

SPRING_ACTIVE_PROFILE=${SPRING_ACTIVE_PROFILE:-"local-docker"}
GIT_BRANCH_LABEL=${GIT_BRANCH_LABEL:-"develop"}

java -jar -Djava.security.egd=file:/dev/urandom -    Dspring.profiles.active=${SPRING_ACTIVE_PROFILE} -    Dgit.config.active.branch=${GIT_BRANCH_LABEL} -Duser.timezone=Asia/Kolkata -XX:+PrintFlagsFinal $JAVA_OPTIONS -jar ${APP_JAR_NAME}.jar

Here's my DockerFile FROM openjdk:8u121-jdk-alpine FROM ubuntu:18.04

ENV APP_JAR_NAME question

RUN apt-get update
RUN apt-get install -y curl apt-utils wget unzip
RUN rm -rf /var/chache/apk/*
RUN mkdir /app

ADD ${APP_JAR_NAME}.jar /app/
COPY run.sh /app/
RUN chmod +x /app/run.sh

WORKDIR /app

EXPOSE 8080

ENTRYPOINT ["/bin/bash","-c"]
CMD ["/app/run.sh"]

I'm having following images in my docker enter image description here I'm looking for the solution for hours but didn't find anything useful. Please help me figure this out. Thanks

Jamshaid
  • 370
  • 2
  • 11
  • 40

1 Answers1

0

The following doesn't merge images, it pulls 2 images and then continues the build based off the second image, Ubuntu, which doesn't include Java:

FROM openjdk:8u121-jdk-alpine
FROM ubuntu:18.04

You probably want the stretch based openjdk image, rather than Alpine, and then remove the second FROM line.

BMitch
  • 231,797
  • 42
  • 475
  • 450