dockerfilelint is an node module that analyzes a Dockerfile and looks for common traps, mistakes and helps enforce best practices.
Installation
Global installation with npm package manager.
npm install -g dockerfilelint
Testing
Start unit tests with npm test, yarn run test, or docker-compose -f docker-compose.test.yml up
Running
From the command line:
./bin/dockerfilelint <path/to/Dockerfile>
Command Line options
Usage: dockerfilelint [files | content..] [options]Options: -o, --output Specify the format to use for output of linting results. Valid values are `json` or `cli` (default). [string] -j, --json Output linting results as JSON, equivalent to `-o json`. [boolean] -v, --version Show version number [boolean] -h, --help Show help [boolean]
Configuring
You can configure the linter by creating a .dockerfilelintrc with the following syntax:
rules: uppercase_commands: off
The keys for the rules can be any file in the /lib/reference.js file. At this time, it's only possible to disable rules. They are all enabled by default.