Skip to main content

hadolint-pre-commit

CI PyPI version PyPI - Python Version License: MIT pre-commit

A pre-commit hook for hadolint that automatically downloads and installs the hadolint binary — no manual installation required.

Background

The official hadolint/hadolint repository provides a pre-commit hook configuration, but it does not auto-install the hadolint binary. Users who add it to their .pre-commit-config.yaml are met with:

Executable `hadolint` not found

This is a known, long-standing issue that affects everyone who tries to use hadolint as a zero-dependency pre-commit hook. The official hook assumes you have already installed hadolint separately (e.g. via brew install hadolint), which defeats the purpose of a self-contained pre-commit integration.

This project solves that problem. It distributes the official, pre-built hadolint binary through PyPI as a platform-specific wheel. When pre-commit sets up the hook environment, it runs pip install hadolint-py automatically — and your binary is ready to use.

Usage

Add the following to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/shenxianpeng/hadolint-pre-commit
    rev: v2.15.1.1
    hooks:
      - id: hadolint

Run pre-commit install and the hadolint binary will be downloaded and installed automatically. That's it.

Passing arguments

You can pass any hadolint CLI argument via the args key:

repos:
  - repo: https://github.com/shenxianpeng/hadolint-pre-commit
    rev: v2.15.1.1
    hooks:
      - id: hadolint
        args: [--ignore, DL3008, --ignore, DL3009]

Using a configuration file

hadolint supports a .hadolint.yaml file in your project root. Create it alongside your Dockerfiles:

# .hadolint.yaml
ignore:
  - DL3008  # Pin versions in apt-get install
  - DL3009  # Delete the apt-get lists after installing

failure-threshold: warning
trustedRegistries:
  - docker.io
  - gcr.io

When a .hadolint.yaml is present, hadolint picks it up automatically — no extra args needed.

How it works

This package ships the hadolint binary via PyPI using setuptools-download. When pip install hadolint-py is run (which pre-commit does automatically), the appropriate pre-built binary for your platform is downloaded from the official hadolint GitHub releases and placed in your environment's bin/ directory (or Scripts/ on Windows).

Supported platforms

OS Architecture
Linux x86_64
Linux arm64
macOS x86_64
macOS arm64
Windows x86_64

Comparison with alternatives

Approach Auto-installs binary Works offline after install Cross-platform Zero extra setup
This project
hadolint/hadolint official hook ❌ (requires pre-installed hadolint)
brew install hadolint + system hook ❌ (manual step) ⚠️ macOS only
Docker-based hook ❌ (requires Docker)

Install as a standalone tool

You can also use hadolint-py outside of pre-commit as a standalone CLI tool:

pip install hadolint-py
hadolint --version
hadolint Dockerfile

Versioning

The PyPI version is derived automatically from the release tag (e.g. tag v2.15.1.1 → PyPI version 2.15.1.1) — reference the matching rev: in your .pre-commit-config.yaml. See CONTRIBUTING.md for the release process.

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hadolint_py-2.15.1.2.tar.gz (8.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hadolint_py-2.15.1.2-py3-none-win_amd64.whl (15.6 MB view details)

Uploaded Python 3Windows x86-64

hadolint_py-2.15.1.2-py3-none-manylinux_2_17_x86_64.whl (12.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

hadolint_py-2.15.1.2-py3-none-manylinux_2_17_aarch64.whl (13.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

hadolint_py-2.15.1.2-py3-none-macosx_10_15_universal2.whl (21.4 MB view details)

Uploaded Python 3macOS 10.15+ universal2 (ARM64, x86-64)

File details

Details for the file hadolint_py-2.15.1.2.tar.gz.

File metadata

  • Download URL: hadolint_py-2.15.1.2.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for hadolint_py-2.15.1.2.tar.gz
Algorithm Hash digest
SHA256 2bab20951d5497461c1c15350d6af97866fdb2842af77777a8bfe8a3668c07ec
MD5 33838c6347985ad405f66ea36a07b43f
BLAKE2b-256 b536ca7181bda86742dcc26853b729a04b35aeb0d1ecdc810f39527c896f7574

See more details on using hashes here.

Provenance

The following attestation bundles were made for hadolint_py-2.15.1.2.tar.gz:

Publisher: publish.yml on shenxianpeng/hadolint-pre-commit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hadolint_py-2.15.1.2-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for hadolint_py-2.15.1.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 dc636b2c96f61e372bf016703cbe07b3b31e9a16b6995f6175fd974f2474c5fd
MD5 f5423ba357a449eb67f3b486c372c7a8
BLAKE2b-256 49341029ec8a3ecb1a680be72d2754250fd4e26145b63e4b9ddc7214e7213755

See more details on using hashes here.

Provenance

The following attestation bundles were made for hadolint_py-2.15.1.2-py3-none-win_amd64.whl:

Publisher: publish.yml on shenxianpeng/hadolint-pre-commit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hadolint_py-2.15.1.2-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hadolint_py-2.15.1.2-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4d0c2e4c2569fddc8774072690f0d23abf5643d69a9bb64277f5d0c8fabd49bd
MD5 c0d40490fa97483888818b0e3765dfe2
BLAKE2b-256 45c26039d33dbdc3c909c8b4ea598a8b0231e430747f7189d46b140a4aeeed9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hadolint_py-2.15.1.2-py3-none-manylinux_2_17_x86_64.whl:

Publisher: publish.yml on shenxianpeng/hadolint-pre-commit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hadolint_py-2.15.1.2-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hadolint_py-2.15.1.2-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 e85fda1da903e53b892a698c2e0eff7cea1f2e90f87f5f29bebbdbf0d4d8e332
MD5 23a043772157d9f7bcd07d5bc7226ffb
BLAKE2b-256 3a282d8d8819031b9c4171784acd892eff957a121641686737f4e321aed86acc

See more details on using hashes here.

Provenance

The following attestation bundles were made for hadolint_py-2.15.1.2-py3-none-manylinux_2_17_aarch64.whl:

Publisher: publish.yml on shenxianpeng/hadolint-pre-commit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hadolint_py-2.15.1.2-py3-none-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for hadolint_py-2.15.1.2-py3-none-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 58b641d14257ec3a4ec1e5c2677068b951c3804c629a8e732be570def2c09231
MD5 aa63b39fb215835e0a2f07efc42b7a51
BLAKE2b-256 d62ffafcaae9e38a4a128663ad3302bc9a40c4b852fdf4ed7cfbc99472e5336a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hadolint_py-2.15.1.2-py3-none-macosx_10_15_universal2.whl:

Publisher: publish.yml on shenxianpeng/hadolint-pre-commit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page