根据以下参考资料https://docs.docker.com/engine/reference/builder/#copy 我认为ADD和COPY没有区别。 请帮我一个解释差异的简单例子。
答案 0 :(得分:15)
在这里找到答案:Docker COPY vs ADD
<src>
成为网址<src>
参数是答案 1 :(得分:1)
来自 Docker 在线文档:
ADD or COPY
Although ADD and COPY are functionally similar, generally speaking, COPY is preferred. That’s because it’s more transparent than ADD. COPY only supports the basic copying of local files into the container, while ADD has some features (like local-only tar extraction and remote URL support) that are not immediately obvious. Consequently, the best use for ADD is local tar file auto-extraction into the image, as in ADD rootfs.tar.xz /.
可在 Best Practices for writing Dockerfiles
找到更多信息基本上,
使用 COPY 进行纯文件和/或目录复制,
使用 ADD 提取 TAR 存档或下载远程内容,