我有一个简单的gradle项目,我想在Docker容器中构建
我有一个多级docker构建.第一阶段只是从github克隆项目.第二阶段必须建立项目,以便我可以在最后阶段运行它.但它失败了
FROM gradle:4.2.1-jdk8-alpine
WORKDIR /app
COPY --from=0 /app/myProject /app
RUN ./gradlew build --stacktrace
命令./gradlew build –stacktrace无法执行,但失败并显示错误:
FAILURE: Build failed with an exception.
* What went wrong:
Could not update /app/.gradle/3.5-rc-2/file-changes/last-build.bin
和堆栈跟踪:
org.gradle.api.UncheckedIOException: Could not update /app/.gradle/3.5-rc-2/file-changes/last-build.bin
at org.gradle.api.internal.changedetection.state.FileTimeStampInspector.updateOnFinishBuild(FileTimeStampInspector.java:72)
at org.gradle.api.internal.changedetection.state.BuildScopeFileTimeStampInspector.stop(BuildScopeFileTimeStampInspector.java:38)
at org.gradle.internal.concurrent.CompositeStoppable.stop(CompositeStoppable.java:98)
.....
Caused by: java.io.FileNotFoundException: /app/.gradle/3.5-rc-2/file-changes/last-build.bin (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
......
为什么docker用户没有权限在工作目录中创建文件以及如何添加这些权限?
简单的RUN chmod 777 / app不起作用并告诉我:chmod:/ app:不允许操作