ADD
The Dockerfile instruction that copies files like COPY, but can also fetch URLs and unpack local archives.
In more detail
Because ADD automatically extracts tar archives and can download from the network, it can do more than you intended. Use COPY for plain files and reach for ADD only when you need its extra behaviour, ideally with a checksum for remote files.
Example
ADD --checksum=sha256:<digest> https://example.com/tool.tgz /opt/Related terms
- COPY — The Dockerfile instruction that copies files from the build context into the image.
- build context — The set of files you hand to docker build, usually the current directory given as the final dot.
Taught in
- Build Context, Dockerignore And Your First Dockerfile — Docker Architecture & Production Containers
- FROM, WORKDIR, COPY And ADD — Docker Architecture & Production Containers
- RUN, SHELL And Efficient Layer Caching — Docker Architecture & Production Containers
- Twelve Lines, Ten Warnings: Dockerfile Instructions And hadolint — Docker Certified Associate (DCA) Exam Prep
- One Edited File, Six Rebuilt Steps: Layers, Cache And Flat Images — Docker Certified Associate (DCA) Exam Prep
- Images Sprint: Eight Questions On Builds, Tags And Registries — Docker Certified Associate (DCA) Exam Prep
- Friday, Nine In The Morning: The Mock Exam And Its Report — Docker Certified Associate (DCA) Exam Prep