Intellij Idea IntelliJ Docker:来自守护进程的错误响应:COPY失败:未指定源文件

yebdmbv4  于 11个月前  发布在  Docker
关注(0)|答案(1)|浏览(116)

大家好,新年快乐!:-)
我对Docker完全陌生,我试图从我的Java项目中构建一个Docker镜像。为了构建我的项目,我使用了Maven和Quarkus的IntelliJ。
以下是我使用的Maven、Quarkus和JDK的版本:

IntelliJ IDEA 2023.2.2
Build #IU-232.9921.47, built on September 12, 2023,
openJDK 17.0.8

个字符
IntelliJ自己创建一个Dockerfile:

Dockerfile.native:

FROM quay.io/quarkus/quarkus-micro-image:2.0
WORKDIR /work/
RUN chown 1001 /work \
    && chmod "g+rwX" /work \
    && chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application

EXPOSE 8080
USER 1001

ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]

问题:

如果我尝试用IntelliJ构建一个docker-image,我会得到这个错误:

Deploying '<unknown> Dockerfile: src/main/docker/Dockerfile'…
Building image…
Preparing build context archive…
[==================================================>]6/6 files
Done

Sending build context to Docker daemon…
[==================================================>] 3,105kB
Done

Step 1/7 : FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8
 ---> 7a93e51a9917
Step 2/7 : WORKDIR /work/
 ---> Using cache
 ---> 2b40db798417
Step 3/7 : RUN chown 1001 /work     && chmod "g+rwX" /work     && chown 1001:root /work
 ---> Using cache
 ---> 32543c06ff9a
Step 4/7 : COPY --chown=1001:root target/*-runner /work/application
Error response from daemon: COPY failed: no source files were specified
Failed to deploy '<unknown> Dockerfile: src/main/docker/Dockerfile': Can't retrieve image ID from build stream


x1c 0d1x的数据
我不明白这个问题。如果有人能给我解释一下,我会很高兴的。
感谢您的阅读
我尝试通过Google和StackOverflow搜索解决方案。我尝试了由IntelliJ创建的其他Dockerfiles:

Dockerfile.native.micro:

FROM quay.io/quarkus/quarkus-micro-image:2.0
WORKDIR /work/
RUN chown 1001 /work \
    && chmod "g+rwX" /work \
    && chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application

EXPOSE 8080
USER 1001

ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]

Dockerfile.jvm:

FROM registry.access.redhat.com/ubi8/openjdk-17:1.17

ENV LANGUAGE='en_US:en'

# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
COPY --chown=185 target/quarkus-app/*.jar /deployments/
COPY --chown=185 target/quarkus-app/app/ /deployments/app/
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/

EXPOSE 8080
USER 185
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"

ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]

vuktfyat

vuktfyat1#

我解决了我的问题。问题是,有些文件不在src路径中。现在它工作正常。

相关问题