---
source: https://iinventedlight.com/library/notes/docker-copy-and-add.md
title: "COPY copies from the build context or another stage; ADD can also fetch URLs and unpack archives"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Docker docs); Apache-2.0 (docker/docs (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Docker docs, Dockerfile reference (COPY and ADD), Apache-2.0 (https://github.com/docker/docs/blob/main/LICENSE); docker/docs (GitHub), Dockerfile reference (docs source, COPY and ADD), Apache-2.0 (https://github.com/docker/docs/blob/main/LICENSE)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-17
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-17
as_of: 2026-11-17
confidence: medium
untested: "Not reproduced (2026-11-17). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: Dockerfile COPY and ADD"
tags: [docker, dockerfile, copy, add, build]
client: Librarian
sources:
  - id: S1
    title: "Dockerfile reference (COPY and ADD)"
    publisher: Docker docs
    url: https://docs.docker.com/reference/dockerfile/
    accessed: 2026-11-17
    license: "Apache-2.0"
  - id: S2
    title: "Dockerfile reference (docs source, COPY and ADD)"
    publisher: docker/docs (GitHub)
    url: https://github.com/docker/docs/blob/main/_vendor/github.com/moby/buildkit/frontend/dockerfile/docs/reference.md
    accessed: 2026-11-17
    license: "Apache-2.0"
---
# COPY copies from the build context or another stage; ADD can also fetch URLs and unpack archives
**Answer:** The `COPY` instruction copies new files or directories from `<src>` into the image at `<dest>`. Sources can come from the build context, a build stage, a named context, or an image. The `ADD` instruction also copies sources into the image, but those sources can come from the build context, a remote URL, or a Git repository.

## How they differ

`ADD` and `COPY` are functionally similar, but they serve slightly different purposes. Prefer `COPY` when you are only copying local files from the context. Use `COPY --from` to copy from a named build stage, context, or image.

Both instructions have a JSON-array form that is required when a path contains whitespace. The last argument is always the destination. If you specify multiple sources, the destination must be a directory and must end with a slash.

## See also

- [docker-multi-stage-builds](https://iinventedlight.com/library/notes/docker-multi-stage-builds/)
- [docker-build-context](https://iinventedlight.com/library/notes/docker-build-context/)
- [docker-dockerignore](https://iinventedlight.com/library/notes/docker-dockerignore/)
- [python-shutil](https://iinventedlight.com/library/notes/python-shutil/)

## Claims

- id: C1
  claim: COPY copies new files from a source into the image at dest.
  source: S1
  evidence: "COPY instruction copies new files"

- id: C2
  claim: ADD and COPY are similar but serve slightly different purposes.
  source: S1
  evidence: "functionally similar, but serve slightly different purposes"

- id: C3
  claim: ADD can copy from the build context, a remote URL, or a Git repository.
  source: S2
  evidence: "can be copied from the build context, a remote URL, or a Git repository"

- id: C4
  claim: COPY can copy from the build context, a build stage, a named context, or an image.
  source: S2
  evidence: "can be copied from the build context, build stage, named context, or an image"

## Sources

- [S1] Dockerfile reference (COPY and ADD). Docker docs. https://docs.docker.com/reference/dockerfile/ . License: Apache-2.0. Accessed 2026-11-17.

- [S2] Dockerfile reference (docs source, COPY and ADD). docker/docs (GitHub). https://github.com/docker/docs/blob/main/_vendor/github.com/moby/buildkit/frontend/dockerfile/docs/reference.md . License: Apache-2.0. Accessed 2026-11-17.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker docs, Dockerfile reference (COPY and ADD), Apache-2.0 (https://github.com/docker/docs/blob/main/LICENSE); docker/docs (GitHub), Dockerfile reference (docs source, COPY and ADD), Apache-2.0 (https://github.com/docker/docs/blob/main/LICENSE). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
