# 使用 Homebrew, dnf, MacPorts, Nix, scoop, winget 安装 hadolint

查看 hadolint 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:hadolint
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install hadolint
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install hadolint
```

  证据: MacPorts ports tree: devel/hadolint/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- dnf (92%):

```sh
sudo dnf install hadolint
```

  证据: Fedora Rawhide package metadata: hadolint from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#hadolint
```

  证据: nixpkgs package indexes: hadolint from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

### Windows

- Scoop (92%):

```sh
scoop install main/hadolint
```

  证据: Scoop official bucket manifest trees: bucket/hadolint.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id hadolint.hadolint -e
```

  证据: Windows Package Manager source index: hadolint.hadolint from https://cdn.winget.microsoft.com/cache/source.msix

## 软件包事实

- **软件包键:** brew:hadolint
- **软件包管理器:** Homebrew
- **版本:** 2.15.1
- **来源摘要:** Smarter Dockerfile linter to validate best practices
- **主页:** <https://github.com/hadolint/hadolint>
- **最后更新:** 2026-07-31T21:47:57Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- hadolint (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 2.15.1
## 项目历史与用法

Hadolint is a Haskell Dockerfile linter that parses Dockerfiles into an abstract syntax tree, applies Dockerfile best-practice rules, and delegates shell snippets in RUN instructions to ShellCheck. In package-manager culture it is a compact, CI-friendly static analyzer for container builds, often installed locally even when the same tool is also available as a container image.

### 项目历史

The first GitHub release in April 2016 described Hadolint as a smarter Dockerfile linter that builds on ShellCheck. Early releases added a clearer command-line interface, multi-file support, Homebrew compatibility, YAML-based ignored-rule configuration, and integration documentation for editors and CI systems.

The project matured by expanding both Dockerfile syntax support and output formats. Release notes record JSON, CodeClimate, Checkstyle XML, Codacy, SonarQube, SARIF, GNU-style, and other formatter work across the 1.x and 2.x lines. Configuration also grew from ignored rules into severity thresholds, trusted registries, label schemas, strict-label behavior, and inline ignore pragmas.

Hadolint 2.0 in 2021 was described by the project as a major internal refactor focused on maintainability and efficiency, with new rule families around LABEL, COPY, useradd, HEALTHCHECK, and package-manager usage. Later releases continued tracking Dockerfile syntax, shell behavior, distribution quirks, and packaging targets such as static binaries and ARM64 builds.

### 采用历史

The README documents several installation paths: prebuilt binaries for macOS, Windows, and Linux, Homebrew on macOS, Scoop on Windows, Nix, Docker Hub images, GHCR images, and source builds with Haskell tooling. That breadth is why Hadolint appears in local developer environments, pre-commit hooks, CI jobs, editor integrations, and containerized lint workflows.

Hadolint's adoption is tied to a specific DevOps habit: treating Dockerfiles like source code with repeatable lint rules. Its GitHub Action companion and integration documentation reinforce the tool's role in pull-request checks, while the CLI remains simple enough for one-off use as `hadolint Dockerfile`.

### 使用方式

Typical package usage is direct CLI linting of one or more Dockerfiles, optionally selecting output formats for CI annotations or machine-readable reports. Users can override severities, ignore specific rule codes, require label schemas, reject untrusted registries, and set a failure threshold that decides when the process exits unsuccessfully.

Hadolint looks for YAML configuration in project and user config locations, using the first file found. This makes the Homebrew package useful for teams that want a repository-local `.hadolint.yaml` while still allowing individual defaults under XDG or home-directory paths.

### 为什么软件包爱好者会关心

Hadolint is package-nerd catnip because it sits at the intersection of Haskell distribution, static binaries, Docker images, shell linting, CI formats, and config-file discovery. It gives a local package manager a cleaner path than `docker run` when a workflow needs fast startup, editor integration, or offline linting.

It also demonstrates how a single-purpose CLI can become infrastructure glue. Package maintainers care about its static binary story, cross-platform release assets, and transitive ShellCheck behavior because those details shape whether Dockerfile linting is painless inside larger build pipelines.

### 时间线

- 2016: v1.0 release introduced the Dockerfile linter built on ShellCheck.
- 2016: v1.2 and v1.2.1 added multi-Dockerfile support and Homebrew compatibility work.
- 2017: v1.2.6 added YAML configuration for ignored rules.
- 2018: v1.5.0 added JSON, CodeClimate JSON, and Checkstyle XML output formats.
- 2018: v1.10.0 added trusted-registry checks for FROM images.
- 2018: v1.13.0 exposed Hadolint for use as a library.
- 2021: v2.0.0 delivered a major internal refactor and added several Dockerfile rule families.
- 2022: v2.10.0 added ARM64 binary support through a new release workflow.
- 2025: v2.14.0 continued rule and package-manager compatibility updates.

### Related projects

- ShellCheck: shell-script analyzer used by Hadolint for RUN instruction shell code.
- language-docker: Dockerfile parser used by Hadolint in its Haskell implementation.
- hadolint-action: GitHub Action wrapper for running Hadolint in workflows.
- Docker and OCI build tooling: the file format and build workflows Hadolint checks.

### 来源

- <https://github.com/hadolint/hadolint>
- <https://github.com/hadolint/hadolint-action>
- <https://github.com/hadolint/hadolint/releases>
- <https://hadolint.github.io/hadolint/>
- <https://raw.githubusercontent.com/hadolint/hadolint/master/README.md>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: $PWD/.hadolint.yaml, $XDG_CONFIG_HOME/hadolint.yaml, ~/.config/hadolint.yaml, ~/.hadolint/hadolint.yaml, ~/hadolint/config.yaml, ~/.hadolint.yaml
## 其他软件包管理器记录

- Nix - hadolint: normalized package name match | nixpkgs package indexes: hadolint from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- dnf - ghc-commutative-semigroups - 0.2.0.2-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-commutative-semigroups from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell commutative-semigroups library | https://hackage.haskell.org/package/commutative-semigroups
- dnf - ghc-commutative-semigroups-devel - 0.2.0.2-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-commutative-semigroups-devel from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell commutative-semigroups library development files | https://hackage.haskell.org/package/hadolint
- dnf - ghc-commutative-semigroups-doc - 0.2.0.2-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-commutative-semigroups-doc from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell commutative-semigroups library documentation | https://hackage.haskell.org/package/hadolint
- dnf - ghc-commutative-semigroups-prof - 0.2.0.2-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-commutative-semigroups-prof from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell commutative-semigroups profiling library | https://hackage.haskell.org/package/hadolint
- dnf - ghc-hadolint - 2.14.0-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-hadolint from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell hadolint library | https://hackage.haskell.org/package/hadolint
- dnf - ghc-hadolint-devel - 2.14.0-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-hadolint-devel from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell hadolint library development files | https://hackage.haskell.org/package/hadolint
- dnf - ghc-hadolint-doc - 2.14.0-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-hadolint-doc from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell hadolint library documentation | https://hackage.haskell.org/package/hadolint
- dnf - ghc-hadolint-prof - 2.14.0-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-hadolint-prof from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell hadolint profiling library | https://hackage.haskell.org/package/hadolint
- dnf - ghc-monoid-subclasses - 1.2.6.1-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-monoid-subclasses from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell monoid-subclasses library | https://hackage.haskell.org/package/monoid-subclasses
- dnf - ghc-monoid-subclasses-devel - 1.2.6.1-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-monoid-subclasses-devel from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell monoid-subclasses library development files | https://hackage.haskell.org/package/hadolint
- dnf - ghc-monoid-subclasses-doc - 1.2.6.1-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-monoid-subclasses-doc from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell monoid-subclasses library documentation | https://hackage.haskell.org/package/hadolint
- dnf - ghc-monoid-subclasses-prof - 1.2.6.1-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-monoid-subclasses-prof from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell monoid-subclasses profiling library | https://hackage.haskell.org/package/hadolint
- dnf - ghc-primes - 0.2.1.0-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-primes from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell primes library | https://hackage.haskell.org/package/primes
- dnf - ghc-primes-devel - 0.2.1.0-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-primes-devel from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell primes library development files | https://hackage.haskell.org/package/hadolint
- dnf - ghc-primes-doc - 0.2.1.0-25.fc45: normalized package name match | Fedora Rawhide package metadata: ghc-primes-doc from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Haskell primes library documentation | https://hackage.haskell.org/package/hadolint


## Combined YAML source

View the package source record on GitHub. [combined/hadolint.yml](https://github.com/mxcl/pkgdb/blob/main/combined/hadolint.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
