advancedTop 100 Interview Questions
What's the difference between COPY and ADD?
COPY simply copies files/directories from the build context into the image. ADD does the same but additionally auto-extracts local tar archives and can fetch remote URLs. Best practice is to default to COPY and use ADD only when you specifically need its extraction or URL-fetch behavior.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response