Docker多阶段COPY:没有此类文件或目录

时间:2019-10-25 18:34:33

标签: java spring docker dockerfile

我正在尝试在Dockerfile的构建器阶段构建项目。 在下一阶段,我想将lib_ivy复制到该阶段的WORKDIR。

FROM pranaysankpal/ant:v0.1 as builder
ARG APP_DIR=/var/builder
COPY build-only $APP_DIR/build-only
COPY lib $APP_DIR/lib
COPY ivy.xml $APP_DIR
COPY ivysettings-local.xml $APP_DIR
COPY build.xml $APP_DIR
WORKDIR $APP_DIR
RUN ant clean resolve
RUN pwd
RUN ls -la

FROM pranaysankpal/ant:v0.1 as compiler
ARG APP_DIR=/var/www/we-api
WORKDIR $APP_DIR
COPY —-from=builder /var/builder/lib_ivy .
CMD tail -f /dev/null

ls和pwd步骤的输出为:

Step 10/16 : RUN pwd
 ---> Running in 26cab920f381
/var/builder
Removing intermediate container 26cab920f381
 ---> 775366e5b8e8
Step 11/16 : RUN ls -la
 ---> Running in 33cc9049a935
total 140
drwxr-xr-x 1 root root  4096 Oct 25 17:53 .
drwxr-xr-x 1 root root  4096 Oct 25 17:53 ..
drwxr-xr-x 4 root root  4096 Oct 25 17:53 build-only
-rw-r--r-- 1 root root 82673 Oct 25 08:05 build.xml
-rw-r--r-- 1 root root  5625 Oct 25 13:00 ivy.xml
-rw-r--r-- 1 root root   734 Aug  9 08:50 ivysettings-local.xml
drwxr-xr-x 2 root root  4096 Oct 25 17:53 lib
drwxr-xr-x 2 root root 28672 Oct 25 17:53 lib_ivy
Removing intermediate container 33cc9049a935
 ---> 93ec932aed3b

COPY步骤的输出为:

STEP 15/16: COPY —-from=builder /var/builder/lib_ivy .
COPY failed: stat /var/lib/docker/tmp/docker-builder118710200/—-from=builder: no such file or directory

0 个答案:

没有答案