在 dockerfile 中使用 cp 复制文件失败

copying files using cp in dockfile fails

我想将一个文件从一个目录复制到另一个目录中的 ubuntu 映像中的 dockfile。我试过 RUN cp make/A.mk ./B.mk RUN make -j4 但它失败了。谁能帮我解决这个问题?谢谢

这不是推荐的方法,要复​​制文件,您有

添加 https://docs.docker.com/engine/reference/builder/#add

复制 https://docs.docker.com/engine/reference/builder/#copy

在 Dockerfile 中

例如参见What is the difference between the `COPY` and `ADD` commands in a Dockerfile?