Skip to content

Files

Latest commit

 

History

History
26 lines (17 loc) · 803 Bytes

DL3020.md

File metadata and controls

26 lines (17 loc) · 803 Bytes

Pattern: Use of ADD instead of COPY

Issue: -

Description

Generally speaking, COPY is preferred because it’s more transparent. ADD has some features (like local-only tar extraction and remote URL support) that are not immediately obvious. Consequently, the best use for ADD is local tar file auto-extraction into the image, as in ADD rootfs.tar.xz /.

Example of incorrect code:

FROM python:3.4
ADD requirements.txt /usr/src/app/

Example of correct code:

FROM python:3.4
COPY requirements.txt /usr/src/app/

Further Reading