How to fix dockerfile parse error line 5: unknown instruction: RRUN in Docker

DockerBEGINNERLOWUpdated Dec 9, 2025· 157 views

This error occurs when Docker encounters an unrecognized instruction in your Dockerfile, typically due to a typo like 'RRUN' instead of 'RUN'. Fixing the typo in your Dockerfile will resolve the issue immediately.

Quick fix

Fixes dockerfile parse error line 5: unknown instruction: RRUN

dockerfile parse error line 5: unknown instruction: RRUN
  1. Locate the error in your Dockerfile
  2. Identify and fix the typo
  3. Rebuild your Docker image
  4. Prevent future typos with a Dockerfile linter
docker — error
dockerfile parse error line 5: unknown instruction: RRUN
dockerfile parse error line 5: unknown instruction: RRUN

What this error means

When you run `docker build`, Docker parses your Dockerfile line by line and expects each line to start with a valid instruction keyword. Docker recognizes a specific set of instructions: FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, LABEL, ARG, USER, VOLUME, HEALTHCHECK, SHELL, STOPSIGNAL, and ONBUILD. The "unknown instruction" error means Docker found text that it cannot match to any valid instruction. In this case, `RRUN` is not a valid instruction—it's a typo for `RUN`. Docker is case-insensitive for instructions (so `run`, `RUN`, and `Run` all work), but it cannot handle misspellings. This is one of the most common beginner mistakes in Dockerfile development. The fix is straightforward: correct the typo and rebuild your image.

Typical symptoms

  • Build fails immediately with 'dockerfile parse error line X: unknown instruction: RRUN'
  • The line number in the error points to the exact location of the typo
  • Docker build command exits with a non-zero status code
  • The build never starts pulling images or executing any layers
  • Error message shows the misspelled instruction name (RRUN, COOPY, FORM, WROKDIR, etc.)

Common causes

  1. Typo in instruction name (e.g., 'RRUN' instead of 'RUN', 'COOPY' instead of 'COPY')
  2. Extra or missing characters in instruction (e.g., 'FROOM' instead of 'FROM')
  3. Keyboard double-tap error causing repeated letters
  4. Copy-paste error from incorrectly formatted documentation or examples
  5. Autocomplete or text expansion inserting incorrect text

How to fix "dockerfile parse error line 5: unknown instruction: RRUN"

1Locate the error in your Dockerfile

The error message tells you exactly where the problem is. Look at the line number mentioned:

bash
dockerfile parse error line 5: unknown instruction: RRUN

This means line 5 of your Dockerfile contains the typo. Open your Dockerfile and navigate to that line:

bash
# View your Dockerfile with line numbers
cat -n Dockerfile

Or in your editor, go to line 5 directly.

2Identify and fix the typo

Compare the instruction in your Dockerfile against the list of valid Docker instructions.

Example of the error:

dockerfile
FROM ubuntu:22.04
WORKDIR /app
COPY . .
RRUN npm install
CMD ["npm", "start"]

Fixed version:

dockerfile
FROM ubuntu:22.04
WORKDIR /app
COPY . .
RUN npm install
CMD ["npm", "start"]

Notice that RRUN was changed to RUN.

Valid Dockerfile instructions to reference:
- FROM - Base image
- RUN - Execute command during build
- CMD - Default command when container starts
- COPY / ADD - Copy files into image
- WORKDIR - Set working directory
- ENV - Set environment variable
- EXPOSE - Document exposed ports
- ENTRYPOINT - Configure container executable
- ARG - Build-time variable
- LABEL - Add metadata
- USER - Set runtime user
- VOLUME - Create mount point

3Rebuild your Docker image

After fixing the typo, rebuild your image:

bash
docker build -t your-image-name .

The build should now proceed past the previously failing line.

Tip: Enable BuildKit for better error messages:

bash
DOCKER_BUILDKIT=1 docker build -t your-image-name .

BuildKit provides more detailed output and clearer error messages.

4Prevent future typos with a Dockerfile linter

Use hadolint to catch syntax errors and typos before building:

bash
# Run hadolint in Docker
docker run --rm -i hadolint/hadolint < Dockerfile

Or install it locally:

bash
# macOS
brew install hadolint

# Linux (download binary)
wget -O /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
chmod +x /usr/local/bin/hadolint

# Then run
hadolint Dockerfile

IDE Integration:

Install the Docker extension for VS Code, which provides:
- Syntax highlighting for Dockerfiles
- Real-time error detection
- Autocomplete for instructions

This catches typos as you type rather than when you build.

Advanced notes

### Common Dockerfile Instruction Typos

Here's a reference of common typos and their corrections:

| Typo | Correct |
|------|---------|
| RRUN, RUNN | RUN |
| FORM, FROOM | FROM |
| COOPY, CPY | COPY |
| WROKDIR, WORKDR | WORKDIR |
| ENTREYPOINT | ENTRYPOINT |
| ENVIORNMENT | ENV |
| EXPSOE | EXPOSE |
| LABLE | LABEL |

### Case Sensitivity

Docker instructions are case-insensitive, so all of these are valid:

dockerfile
RUN echo "hello"
run echo "hello"
Run echo "hello"

However, the convention is to use UPPERCASE for instructions to distinguish them from arguments.

### IDE and Editor Setup

VS Code settings for Dockerfile validation:

Add to your .vscode/settings.json:

json
{
  "[dockerfile]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "ms-azuretools.vscode-docker"
  }
}

Pre-commit hook with hadolint:

Add to .pre-commit-config.yaml:

yaml
repos:
  - repo: https://github.com/hadolint/hadolint
    rev: v2.12.0
    hooks:
      - id: hadolint-docker

This validates your Dockerfile before every commit, preventing typos from being committed.

### CI/CD Integration

Add Dockerfile linting to your CI pipeline:

GitHub Actions:

yaml
- name: Lint Dockerfile
  uses: hadolint/hadolint-action@v3.1.0
  with:
    dockerfile: Dockerfile

GitLab CI:

yaml
lint:dockerfile:
  image: hadolint/hadolint:latest
  script:
    - hadolint Dockerfile

Frequently asked questions

What does "dockerfile parse error line 5: unknown instruction: RRUN" mean?
When you run docker build, Docker parses your Dockerfile line by line and expects each line to start with a valid instruction keyword. Docker recognizes a specific set of instructions: FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, LABEL, ARG, USER, VOLUME, HEALTHCHECK, SHELL, STOPSIGNAL, and ONBUILD. The "unknown instruction" error means Docker found text that it cannot match to any valid instruction.
How do I fix "dockerfile parse error line 5: unknown instruction: RRUN"?
This error occurs when Docker encounters an unrecognized instruction in your Dockerfile, typically due to a typo like 'RRUN' instead of 'RUN'. Fixing the typo in your Dockerfile will resolve the issue immediately.
What causes "dockerfile parse error line 5: unknown instruction: RRUN"?
Typo in instruction name (e.g., 'RRUN' instead of 'RUN', 'COOPY' instead of 'COPY') Extra or missing characters in instruction (e.g., 'FROOM' instead of 'FROM') Keyboard double-tap error causing repeated letters
Is the "dockerfile parse error line 5: unknown instruction: RRUN" error serious?
It is a low-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading