Skip to content
Latchkey

Dockerfile "COPY requires at least two arguments" in CI

The Dockerfile parser rejected a COPY that has only one argument. COPY needs both a source and a destination, so a single token leaves the destination undetermined.

What this error means

docker build fails at parse time with "COPY requires at least two arguments, but only one was provided. Destination could not be determined."

docker build
COPY requires at least two arguments, but only one was provided.
Destination could not be determined.

Common causes

Missing destination argument

The instruction is written as COPY app.py with nothing after it, so there is no destination path.

An unexpanded variable collapsed the arguments

A build ARG that resolved to empty removed the destination, leaving a single argument.

How to fix it

Provide a destination

Give COPY both a source and a destination path.

Dockerfile
COPY app.py /app/
# or copy into the current WORKDIR
COPY app.py .

Verify any variables resolve

  1. Check that ARG or ENV values used in the COPY are set.
  2. Print them during build if a destination keeps collapsing.
  3. Quote paths that may contain spaces.

How to prevent it

  • Always write COPY with an explicit destination.
  • Confirm build args used in paths are defined.
  • Lint the Dockerfile to catch single-argument COPY early.

Frequently asked questions

What causes ""COPY requires at least two arguments""?
The instruction is written as COPY app.py with nothing after it, so there is no destination path.
How do I fix "COPY requires at least two arguments"?
Give COPY both a source and a destination path.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card