我已经根据您的项目创建了 Docker 映像,但 docker run 抛出错误:无法找到或加载主类 org.gradle.wrapper.GradleWrapperMain.Here is 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