【问题标题】:Getting error "Not Found" when the script is trying to find .sh in Dockerfile当脚本尝试在 Dockerfile 中查找 .sh 时出现错误“未找到”
【发布时间】:2019-03-01 08:25:34
【问题描述】:

DockerFile - 路径是 rootDirectory/odm-ondocker/decisionserver/decisionserverconsole。

ARG FROMLIBERTY
FROM maven:3.5.2-jdk-8-alpine AS builder
ARG ODMDOCKERDIR
ENV ODMDOCKERDIR $ODMDOCKERDIR
ENV SCRIPT /script
ENV APPS /config/apps
COPY $ODMDOCKERDIR/welcomepage /welcomepage
COPY $ODMDOCKERDIR/common/script $SCRIPT
COPY $ODMDOCKERDIR/common/drivers /config/resources
COPY $ODMDOCKERDIR/common/features $SCRIPT
COPY $ODMDOCKERDIR/decisionserver/decisionserverconsole/script $SCRIPT
COPY $ODMDOCKERDIR/decisionserver/decisionserverruntime/script $SCRIPT
# Use production liberty if needed
RUN echo $SCRIPT
COPY $ODMDOCKERDIR/resources/* /wlp-embeddable/
RUN chmod a+x $SCRIPT/fixWLPForProduction.sh && sync && $SCRIPT/fixWLPForProduction.sh
# Install missing require package in the alpine builder image
RUN apk add --no-cache bash perl ca-certificates wget
# Build Welcome page
RUN cd /welcomepage; mvn -B clean install | grep -v 'Download.*' && mkdir -p $APPS

我在 RUN chmod a+x $SCRIPT/fixWLPForProduction.sh && sync && $SCRIPT/fixWLPForProduction.sh 线上遇到错误,如下所示:-

/bin/sh: /script/fixWLPForProduction.sh: 未找到 错误:服务“odm-decisionserverconsole”无法构建:命令“/bin/sh -c chmod a+x $SCRIPT/fixWLPForProduction.sh && sync && $SCRIPT/fixWLPForProduction.sh”返回非零代码:127

我是 docker 新手,因此无法弄清楚为什么它会出现,尽管该文件存在于根目录/common/scripts 文件夹中。我想通了,它试图找到 /odm-ondocker/common/script 下的脚本文件夹。我尝试将 SCRIPT 变量的值作为 /common/script 给出,但它仍然给出为 Not Found。

【问题讨论】:

    标签: docker-compose dockerfile odm


    【解决方案1】:

    运行 chmod a+x $SCRIPT/fixWLPForProduction.sh && sync && $SCRIPT/fixWLPForProduction.sh
    正在寻找您的 ENV SCRIPT 命令定义的脚本 /script/fixWLPForProduction.sh。但是您在评论中说脚本是 /common/script/fixWLPForProduction.sh 尝试使用它 ENV SCRIPT /common/script 或者使用脚本的绝对路径。从那里,您可以知道如何正确设置 ENV 变量

    【讨论】:

    • 我重新格式化了它。如果您需要更多说明,请告诉我。
    猜你喜欢
    • 2017-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-09
    • 1970-01-01
    • 2016-05-29
    • 2021-03-04
    • 1970-01-01
    相关资源
    最近更新 更多