Lint Dockerfile
The Lint Dockerfile action enables automatic validation of Dockerfiles for building efficient Docker images. The tool uses ShellCheck analysis to inspect code within RUN instructions and detects common errors as well as performance issues.
ShellCheck
ShellCheck is a static analysis tool for shell scripts that helps detect errors, deviations from best practices, and potential issues in shell code.
In the context of a Dockerfile, ShellCheck analyzes all RUN instructions for:
- Syntax errors
- Potential security risks
- Incorrect variable usage
Error levels
The linter distinguishes three levels of errors:
- info - suggestions and best practices
- warning - warnings about potential issues
- error - critical errors requiring attention
Image loading...
Configuration
Dockerfile - Path of the Dockerfile to validate.
Ignore Lint Errors - Select which Dockerfile to ingore during the validation. Check the full list of errors.
ShellCheck - Type of shell in which the errors will be detected. Available values:
- Don't check shell commands
- sh
- bash
- dash
- ksh
Ignore ShellCheck Errors - Select ShellCheck errors to ignore.
Ignoring errors in YAML
You can create a YAML file named "dockerfile-name".linter.yaml with a list of ignore rules for a specific Dockerfile, or dockerfilelinter.yaml to apply to all the Dockerfiles in the folder. If you place the file in the same directory as the Dockerfile, it will be detected automatically. You can also use the -y/--yaml flag to specify the path manually.
For example:
yamlignore: - ER0012 - ER0015 - SC1000
YAML and API
- YAML configuration - Dockerfile linter configuration via YAML
- REST API - adding actions via API
Last modified on Oct 29, 2025