beginnerDockerfile Instructions & Multi-Stage Builds

What is the difference between COPY and ADD?

COPY does a literal, predictable file/directory copy from the build context into the image. ADD does everything COPY does, plus two extra behaviors: it can download a file from a remote URL, and it automatically extracts recognized local archive formats (tar, gzip) into the destination. Best practice is to prefer COPY unless you specifically need one of ADD's extra behaviors.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

What is the difference between COPY and ADD?

Next Step

Continue to What is the difference between ARG and ENV?← Back to all Docker questions