Common causes
- An unknown or misspelled instruction keyword (e.g., COPIES instead of COPY)
- A line continuation backslash \ with trailing spaces or a Windows-style CRLF line ending after it
- Instructions appearing before the first FROM (except ARG, which is allowed before FROM)
- An empty or malformed instruction line
How to fix it
- Read the error line number and check that line in your Dockerfile
- Ensure all instructions use valid keywords: FROM, RUN, COPY, ADD, ENV, EXPOSE, CMD, ENTRYPOINT, WORKDIR, ARG, LABEL, USER, VOLUME
- Convert Windows line endings to Unix: sed -i 's/\r//' Dockerfile, or use dos2unix Dockerfile
- Validate the Dockerfile with: docker build --check . (Docker 24+) or a linter like hadolint
Example
$ docker build .
Error response from daemon: dockerfile parse error line 5: unknown instruction: COPIESTypo in the Dockerfile — COPIES instead of COPY on line 5
Browse more errors
The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.
