我在 docker 中创建了一个图像,并/app/run.sh: line 7: java: command not found
尝试使用它运行它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
这是我的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"]