gpt4 book ai didi

docker - 创建了Docker镜像但docker run抛出错误:无法找到或加载主类org.gradle.wrapper.GradleWrapperMain

转载 作者:行者123 更新时间:2023-12-03 05:39:49 26 4
gpt4 key购买 nike

我已经根据您的项目创建了Docker镜像,但是docker run抛出错误:找不到或加载主类org.gradle.wrapper.GradleWrapperMain。如果您想调试和运行并帮助我修复此错误,则这里为dockerfile

FROM OpenJDK:8-JDK-alpine

WORKDIR /opt

RUN wget -q https://services.gradle.org/distributions/gradle-3.3-bin.zip
&& unzip gradle-3.3-bin.zip -d /opt
&& rm gradle-3.3-bin.zip

RUN echo "$PWD"

RUN apk add git

RUN git clone https://github.com/TechieTester/gatling-fundamentals.git

RUN echo "$PWD"

RUN cp -vif /opt/gatling-fundamentals/gradlew /opt/gradle-3.3/bin/

RUN mv -vif /opt/gatling-fundamentals/src/* /opt/gradle-3.3/bin/

RUN find /opt/

RUN chmod 777 /opt/gradle-3.3/bin/gradlew

ENV GRADLE_HOME /opt/gradle-3.3
ENV PATH $PATH:/opt/gradle-3.3/bin

使用本地以下命令成功创建docker镜像后
docker build -t fromscratch4:local .

尝试使用以下命令运行
请注意,我已使用以下方式完全访问了gradlew
chmod 777 gradlew

您会在下面收到一条错误消息...请帮助
PS C:\Gatling2\gatling6games> docker run --rm -w /opt/gatling-fundamentals/ 
fromscratch4:local sh -c "gradle wrapper | gradlew gatlingRun
simulations.RuntimeParameters"
Error: Could not find or load main class
org.gradle.wrapper.GradleWrapperMain

最佳答案

@MatthewLDaniel的回复有效

关于docker - 创建了Docker镜像但docker run抛出错误:无法找到或加载主类org.gradle.wrapper.GradleWrapperMain,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53734967/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com