http://blog.163.com/digoal@126/blog/static/163877040201410341236664/
 
在Dockerfile中, 我们可以使用ADD和COPY拷贝文件(注意是上下文相关目录的文件, 不是本地的任意文件, 除非上下文目录是根)到container制作image.
那么两者有什么区别呢?
 
ADD 多了2个功能, 下载URL和解压.  其他都一样.
如果你不希望压缩文件拷贝到container后会被解压的话, 那么使用COPY.
如果需要自动下载URL并拷贝到container的话, 请使用ADD.
 
  • If <src> is a URL and <dest> does not end with a trailing slash, then a file is downloaded from the URL and copied to <dest>.

  • If <src> is a URL and <dest> does end with a trailing slash, then the filename is inferred from the URL and the file is downloaded to <dest>/<filename>. For instance, ADD http://example.com/foobar / would create the file /foobar. The URL must have a nontrivial path so that an appropriate filename can be discovered in this case (http://example.com will not work).

  • If <src> is a local tar archive in a recognized compression format (identity, gzip, bzip2 or xz) then it is unpacked as a directory. Resources from remote URLs are not decompressed. When a directory is copied or unpacked, it has the same behavior as tar -x: the result is the union of:

    1. Whatever existed at the destination path and
    2. The contents of the source tree, with conflicts resolved in favor of "2." on a file-by-file basis.
[参考]

最新文章

  1. python浅谈正则的常用方法
  2. Android 跑马灯
  3. C#的变迁史 - C# 4.0 之多线程篇
  4. c# select标签绑定枚举,并以Description做Text显示
  5. 使用 python 操作 redis
  6. [vijos P1034] 家族
  7. 完美解决方案,可排除DATASET不支持System.Nullable错误
  8. xaml中绑定单例属性
  9. WPF学习笔记3&mdash;&mdash;Layout之1
  10. Extjs 3.0 htmleditor实现插入图片功能
  11. linux_创建用户_copy远程文件_解压缩_执行
  12. 使用Angular CLI进行单元测试和E2E测试
  13. 一次使用innobackupex重新搭建主从复制报错解决方法及注意事项
  14. 使用kettle来根据时间戳或者批次号来批量导入数据,达到增量的效果。
  15. 将HTML页面自动保存为PDF文件并上传的两种方式(一)-前端(react)方式
  16. Openresty 学习笔记(二)Nginx Lua 正则表达式相关API
  17. ArcGis辅助编号(半自动)功能的插件式实现
  18. Git在eclipse中的使用,克隆导入eclipse项目
  19. crm 中使用的Django方法
  20. [CodeForces - 197F] F - Opening Portals

热门文章

  1. 在chrome下-webkit-box布局的一个bug
  2. bzoj1066
  3. js-图标控件
  4. Cygwin使用方法
  5. bzoj3998: [TJOI2015]弦论
  6. iOS清理缓存的几种方法
  7. C++11特性:auto关键字
  8. js-自制轮播插件!
  9. Hadoop设置环境变量注意事项
  10. 【csuoj1014】 西湖三人行