Skip to content

Change in best practices for ADD instruction used instead of COPY #74

@JBodkin-Amphora

Description

@JBodkin-Amphora

The Best Practices documentation from Docker has changed and they now recommend using the ADD instruction when you need to download a remote artifact as part of your build, allowing for a more precise build cache.

The ADD instruction is best for when you need to download a remote artifact as part of your build. ADD is better than manually adding files using something like wget and tar, because it ensures a more precise build cache. ADD also has built-in support for checksum validation of the remote resources, and a protocol for parsing branches, tags, and subdirectories from Git URLs.

From a previous issue, I could not find the quoted paragraph on the documentation anymore.

Because image size matters, using ADD to fetch packages from remote URLs is strongly discouraged; you should use curl or wget instead. That way you can delete the files you no longer need after they’ve been extracted and you won’t have to add another layer in your image.

Would it be possible to update the rule to support ADD when fetching files from remote (HTTPS or Git Urls) and extracting tar file automatically when adding files from the build context?

ADD supports features for fetching files from remote HTTPS and Git URLs, and extracting tar files automatically when adding files from the build context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions