Docker: 无法在容器内复制文件
Docker: cannot copy file within the container
这不是关于在主机和容器之间传输文件,它只是在容器内部。
app.js 存在于构建目录中。
Step 7 : RUN ls build
---> Running in 8461a550a5db
app.js
app.js.map
css
html
img
js
---> 22a863b60265
应复制到 static 文件夹。
Removing intermediate container 8e195477d342
Step 9 : RUN cp build/app.js static/
---> Running in 0a49669338e0
---> 41cb4d3039d1
但它不在那里。为什么?
Removing intermediate container 0a49669338e0
Step 10 : RUN ls static/
---> Running in 4cdb5f74a722
css
html
img
js
尝试过:运行 cp ./build/app.js ./static/ - 也不起作用。
您可以尝试使用 docker 无缓存构建吗?
docker build -t "your_app" --no-cache=true .
问题在这里:
Removing intermediate container 0a49669338e0
来自 Docker 文档:https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#build-cache
During the process of building an image Docker will step through the
instructions in your Dockerfile executing each in the order specified.
As each instruction is examined Docker will look for an existing image
in its cache that it can reuse, rather than creating a new (duplicate)
image. If you do not want to use the cache at all you can use the
--no-cache=true option on the docker build command.
这不是关于在主机和容器之间传输文件,它只是在容器内部。
app.js 存在于构建目录中。
Step 7 : RUN ls build
---> Running in 8461a550a5db
app.js
app.js.map
css
html
img
js
---> 22a863b60265
应复制到 static 文件夹。
Removing intermediate container 8e195477d342
Step 9 : RUN cp build/app.js static/
---> Running in 0a49669338e0
---> 41cb4d3039d1
但它不在那里。为什么?
Removing intermediate container 0a49669338e0
Step 10 : RUN ls static/
---> Running in 4cdb5f74a722
css
html
img
js
尝试过:运行 cp ./build/app.js ./static/ - 也不起作用。
您可以尝试使用 docker 无缓存构建吗?
docker build -t "your_app" --no-cache=true .
问题在这里:
Removing intermediate container 0a49669338e0
来自 Docker 文档:https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#build-cache
During the process of building an image Docker will step through the instructions in your Dockerfile executing each in the order specified. As each instruction is examined Docker will look for an existing image in its cache that it can reuse, rather than creating a new (duplicate) image. If you do not want to use the cache at all you can use the --no-cache=true option on the docker build command.