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.
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.
The error message tells you exactly where the problem is. Look at the line number mentioned:
dockerfile parse error line 5: unknown instruction: RRUNThis means line 5 of your Dockerfile contains the typo. Open your Dockerfile and navigate to that line:
# View your Dockerfile with line numbers
cat -n DockerfileOr in your editor, go to line 5 directly.
Compare the instruction in your Dockerfile against the list of valid Docker instructions.
Example of the error:
FROM ubuntu:22.04
WORKDIR /app
COPY . .
RRUN npm install
CMD ["npm", "start"]Fixed version:
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
After fixing the typo, rebuild your image:
docker build -t your-image-name .The build should now proceed past the previously failing line.
Tip: Enable BuildKit for better error messages:
DOCKER_BUILDKIT=1 docker build -t your-image-name .BuildKit provides more detailed output and clearer error messages.
Use hadolint to catch syntax errors and typos before building:
# Run hadolint in Docker
docker run --rm -i hadolint/hadolint < DockerfileOr install it locally:
# 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 DockerfileIDE 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.
### 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:
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:
{
"[dockerfile]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
}
}Pre-commit hook with hadolint:
Add to .pre-commit-config.yaml:
repos:
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint-dockerThis validates your Dockerfile before every commit, preventing typos from being committed.
### CI/CD Integration
Add Dockerfile linting to your CI pipeline:
GitHub Actions:
- name: Lint Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: DockerfileGitLab CI:
lint:dockerfile:
image: hadolint/hadolint:latest
script:
- hadolint DockerfileError response from daemon: manifest for nginx:nonexistent not found: manifest unknown: manifest unknown
How to fix 'manifest for image:tag not found' in Docker
Error response from daemon: invalid reference format: repository name must be lowercase
How to fix 'repository name must be lowercase' in Docker
Error response from daemon: No such image
How to fix 'No such image' in Docker
Error response from daemon: Container is not running
How to fix 'Container is not running' when using docker exec
the input device is not a TTY
How to fix 'the input device is not a TTY' in Docker