• Docker Dockerfile COPY vs ADD


    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.
    [参考]
  • 相关阅读:
    Lua metatable & metamethod
    lua 中的点、冒号与self
    Eclipse 快捷键
    logging的使用
    URL转义字符
    UnicodeEncodeError: ‘ascii’ codec can’t encode
    Baidu URL的部分参数
    使用JS伪造Post请求
    print 不换行
    exception keynote
  • 原文地址:https://www.cnblogs.com/shiningrise/p/5737241.html
Copyright © 2020-2023  润新知