Docker文件中的“COPY”和“ADD”命令有什么区别? [英] What is the difference between the `COPY` and `ADD` commands in a Dockerfile?
本文介绍了Docker文件中的“COPY”和“ADD”命令有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Dockerfile中的 COPY
和 ADD
命令之间有什么区别,以及何时使用一个另一个?
What is the difference between the COPY
and ADD
commands in a Dockerfile, and when would I use one over the other?
COPY <src> <dest>
COPY指令将从
< src>
并将它们添加到
容器的文件系统路径< dest>
ADD <src> <dest>
ADD指令将从
< src>
并将它们添加到
容器的文件系统路径< dest>
。
推荐答案
您应该检查 添加
和 COPY
文档,详细描述他们的行为,但总而言之,主要的区别是添加
可以超过 COPY
:
You should check the ADD
and COPY
documentation for an exhaustive description of their behaviours, but in a nutshell the major difference is that ADD
can do more than COPY
:
-
ADD
允许< src>
成为一个URL - 如果
< src>
参数ADD
是一种可识别压缩格式的存档,它将被解压缩
ADD
allows<src>
to be an URL- If the
<src>
parameter ofADD
is an archive in a recognised compression format, it will be unpacked
这篇关于Docker文件中的“COPY”和“ADD”命令有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文