# hadolint

> Dockerfile linter that parses AST and integrates with ShellCheck to validate Docker best practices and bash code in RUN instructions

Stars: 12.5k · Language: Haskell · License: GPL-3.0 · Categories: Dev Tools

- Repository: https://github.com/hadolint/hadolint
- Page: https://www.trmn.sh/tools/hadolint

## Install

- Homebrew: `brew install hadolint`
- Docker: `docker pull hadolint/hadolint`
- Scoop (Windows): `scoop install hadolint`

## Overview

Hadolint is a Dockerfile linter that parses Dockerfiles into an Abstract Syntax Tree (AST) and applies rules to validate Docker best practices. The tool integrates with ShellCheck to lint bash code inside RUN instructions, providing comprehensive validation beyond basic Dockerfile syntax. It supports multiple output formats including TTY, JSON, checkstyle, codeclimate, and SARIF.

The linter offers extensive configuration options through YAML config files, supporting rule severity overrides, trusted registry validation, and label schema enforcement. Users can ignore specific rules globally or inline, set failure thresholds, and customize rule severity levels (error, warning, info, style). Hadolint validates trusted registries in FROM instructions and can enforce specific label schemas with format requirements.

Hadolint runs as a standalone binary or through Docker containers, making it suitable for local development and CI/CD pipelines. It provides both minimal containers and variants with shell access (Debian/Alpine). The tool integrates with various development environments including VS Code extensions and supports configuration through environment variables or command-line options.

### Installation

```bash
# via Homebrew
brew install hadolint
```

```bash
# via Docker
docker pull hadolint/hadolint
```

```bash
# via Scoop (Windows)
scoop install hadolint
```

![Hadolint online interface screenshot](https://media.trmn.sh/cached/cdedbeda916f6050d5eb3028e8b684b544ba8c7f4181a533765f690e4bcea0f9.png)

## Alternatives

- [ShellCheck](https://www.trmn.sh/tools/shellcheck.md): Static analysis tool that identifies syntax errors, semantic problems, and pitfalls in bash/sh shell scripts (Haskell, 40.3k stars)
- [GDB dashboard](https://www.trmn.sh/tools/gdb-dashboard.md): A standalone .gdbinit written in Python that shows a modular dashboard of program state in GDB each time the debugged program stops. (Python, 12.3k stars)
- [tsx](https://www.trmn.sh/tools/tsx.md): TypeScript Execute (tsx): a CLI for running TypeScript files directly in Node.js. (TypeScript, 12.2k stars)
- [ipatool](https://www.trmn.sh/tools/ipatool.md): CLI for searching the App Store for iOS, iPadOS, tvOS, visionOS and macOS apps and downloading .ipa or macOS .pkg packages. (Go, 12.1k stars)
- [npm-check-updates](https://www.trmn.sh/tools/npm-check-updates.md): CLI that upgrades package.json dependencies to their latest versions, preserving semver range operators. Works with npm, yarn, pnpm, deno, and bun. (TypeScript, 10.3k stars)

---

Canonical: https://www.trmn.sh/tools/hadolint
