unknown instruction 🐳 Docker

Dockerfile parse error line N: unknown instruction

A line in the Dockerfile doesn’t start with a valid instruction — usually a broken line continuation or a typo.

Seen on: Docker

Meaning

Every non-comment line must start with an instruction (FROM, RUN, COPY…). If a multi-line RUN is missing a trailing backslash, or has a space after it, the next line is read as a new instruction like “apt-get” or “&&”.

Common causes

  • Missing \ at the end of a continued line
  • Space or CRLF after the backslash
  • Typo in an instruction (COPPY, ENTRYPIONT)
  • Shell commands pasted without RUN

⚡ Quick fix

  1. Check the line number and the line before it
  2. Make sure each continued line ends with \ and nothing after it
  3. Convert the file to LF line endings

Detailed fix by platform

Dockerfile

  1. bash
    RUN apt-get update \\
     && apt-get install -y curl

How to diagnose

  1. Line — The reported line and the one above
  2. Endings — file Dockerfile (CRLF?)

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.