Hadolint with Docker: Lint Your Dockerfiles Before You Build (Linux, Windows, Mac)
Before you start
- 20 min read
Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#
Hadolint is a free, open-source linter for Dockerfiles: it reads the file, applies a list of best-practice rules (and ShellCheck on the shell commands inside RUN lines) and prints what looks wrong, before you build anything.

Logo: the official Hadolint project (github.com/hadolint/hadolint, file website/img/cat_container.png). The repository is GPL-3.0 and we found no separate artwork licence.
It finds small mistakes that make images bigger and builds less repeatable: a base image with no tag, packages with no version, package caches left in a layer, a pipe that hides a failed download. It builds nothing and has no server, web page or port. You run one command and read the list.
| What | Value (official sources, read 3 December 2026) |
|---|---|
| Current version | Hadolint v2.15.1, released 31 July 2026 (previous: v2.15.0, 30 July 2026) |
| Image to pin | hadolint/hadolint:v2.15.1 (note the v; also on ghcr.io/hadolint/hadolint) |
| Time needed | About 15 minutes (our estimate, not measured) |
| Size | About 12 MB compressed for amd64 (Docker Hub API); the Linux binary is about 53 MiB |
| Ports | None |
| Licence | GPL-3.0 (LICENSE in the repository). It covers Hadolint, not the Dockerfiles you lint (our plain reading, not legal advice) |
| Official docs | github.com/hadolint/hadolint (README and rule wiki) |
At a glance:
- What it is: one command-line program (Haskell, a single file).
DLrules are Hadolint's own,SCrules come from ShellCheck. - What it checks: the Dockerfile text, not your built image. Our Trivy guide scans images and our Dive guide shows what is in the layers.
- Three ways to run it: a Docker container (nothing to install), a binary, or a step in CI. You choose which of the four severities fails the check.
How it fits together#
You hand Hadolint a Dockerfile (and, if you have one, a .hadolint.yaml). It parses the file, applies its rules, passes the shell parts to ShellCheck, prints a list of findings and sets an exit code. Your build only starts when the exit code is 0.
Drawn for this guide from the official README. The dashed step is yours: Hadolint never builds.
A finding is one line of output. The exit code is the number the program returns: 0 means "pass", 1 means "a finding at or above your threshold".
Before you start#
Note: every domain, path and value on this page is a dummy example (like
example.com). Replace it with your own.
| System | What to have |
|---|---|
| Linux | Docker Engine, or just curl for the binary |
| Windows | Windows 10 or later, PowerShell, and Docker Desktop (WSL 2 backend) for the container route |
| Mac | Docker Desktop or Homebrew, Intel or Apple Silicon |
docker --version
Checklist:
- [ ]
docker --versionprints a version (skip it if you only use the binary) - [ ] Your Dockerfiles are in Git
Tested by DIY Lab Hub on 2026-12-03: the Docker image v2.15.1 on Docker Desktop for Windows, the Windows binary in PowerShell, and the Linux download and checksum steps in a Debian container. Not run: Mac, Homebrew, Scoop and the CI pipelines (from the official docs).
Step 1: Lint a first Dockerfile with Docker#
No install is needed. The project's own README gives this command: you pipe the Dockerfile into the container. We pin the tag, because latest moves.
Linux#
mkdir -p ~/docker_volumes/hadolint/{samples,config}
cd ~/docker_volumes/hadolint/samples
cat > Dockerfile << 'EOF'
FROM ubuntu
RUN apt-get update
RUN apt-get install -y curl python3
RUN pip install flask
RUN cd /opt && curl -s https://example.com/app.tar.gz | tar xz
ADD config.txt /opt/
ENV APP_PORT=8080
CMD python3 /opt/app.py
EOF
docker run --rm -i hadolint/hadolint:v2.15.1 < Dockerfile
echo "exit code: $?"
Windows (PowerShell)#
PowerShell does not accept <. It stops with "The '<' operator is reserved for future use." Pipe the file in with Get-Content, as the official README does.
$base = "$HOME\docker_volumes\hadolint" New-Item -ItemType Directory -Force "$base\samples","$base\config" | Out-Null Set-Location "$base\samples" @' FROM ubuntu RUN apt-get update RUN apt-get install -y curl python3 RUN pip install flask RUN cd /opt && curl -s https://example.com/app.tar.gz | tar xz ADD config.txt /opt/ ENV APP_PORT=8080 CMD python3 /opt/app.py '@ | Set-Content -Encoding ascii Dockerfile Get-Content .\Dockerfile | docker run --rm -i hadolint/hadolint:v2.15.1 "exit code: $LASTEXITCODE"
Mac (Terminal)#
Same commands as Linux.
This is the real output of v2.15.1 for that file (we removed the terminal colours):
-:1 DL3006 warning: Always tag the version of an image explicitly -:2 DL3009 info: Delete the apt lists (/var/lib/apt/lists) after installing something -:3 DL3015 info: Avoid additional packages by specifying `--no-install-recommends` -:3 DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>` -:3 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation. -:4 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation. -:4 DL3042 warning: Avoid use of cache directory with pip. Use `pip install --no-cache-dir <package>` -:4 DL3013 warning: Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>` or `pip install --requirement <requirements file>` -:5 DL3003 warning: Use WORKDIR to switch to a directory -:5 DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check -:6 DL3020 error: Use COPY instead of ADD for files and folders -:8 DL3025 warning: Use arguments JSON notation for CMD and ENTRYPOINT arguments exit code: 1
Read one line: -:3 is "stdin, line 3" (with a file name you see the name instead of -), DL3008 is the rule, warning is the severity, and the rest says what to change. Each rule has a page at github.com/hadolint/hadolint/wiki/<RULE>.
Check it worked. You see a list like the one above and the exit code is 1. A clean Dockerfile prints nothing and returns 0.
Tip: Hadolint has no
--fix. It only reports. You edit the Dockerfile.
Step 2: Or install the binary#
The binary is faster in a loop and needed for Git hooks. Official downloads exist for Linux, macOS (both x86_64 and arm64) and Windows (x86_64), with a checksums.sha256 file that we check.
Linux#
For an x86_64 machine (use hadolint-linux-arm64 on arm64):
cd "$(mktemp -d)" base=https://github.com/hadolint/hadolint/releases/download/v2.15.1 curl -fsSL -o hadolint-linux-x86_64 "$base/hadolint-linux-x86_64" curl -fsSL -o checksums.sha256 "$base/checksums.sha256" grep ' \*hadolint-linux-x86_64$' checksums.sha256 | sha256sum -c - mkdir -p "$HOME/.local/bin" install -m 0755 hadolint-linux-x86_64 "$HOME/.local/bin/hadolint" hadolint --version
Make sure $HOME/.local/bin is in your PATH.
Windows (PowerShell)#
$base = "https://github.com/hadolint/hadolint/releases/download/v2.15.1" New-Item -ItemType Directory -Force "$HOME\bin" | Out-Null Set-Location "$HOME\bin" Invoke-WebRequest "$base/hadolint-windows-x86_64.exe" -OutFile hadolint-windows-x86_64.exe Invoke-WebRequest "$base/checksums.sha256" -OutFile checksums.sha256 $expected = ((Select-String -Path checksums.sha256 -Pattern 'hadolint-windows-x86_64.exe').Line -split ' ')[0] (Get-FileHash .\hadolint-windows-x86_64.exe -Algorithm SHA256).Hash -eq $expected Rename-Item hadolint-windows-x86_64.exe hadolint.exe .\hadolint.exe --version
The comparison must print True. Add $HOME\bin to your PATH to call it as hadolint. The README also names Scoop: scoop install hadolint (bucket at 2.15.1 on 3 December 2026). There is no WinGet package: the request (issue 1217) is open because WinGet needs an installer and the project ships only the bare .exe.
Mac (Terminal)#
Homebrew is the documented route (formula at 2.15.1 on 3 December 2026):
brew install hadolint hadolint --version
Without Homebrew, download hadolint-macos-arm64 (Apple Silicon) or hadolint-macos-x86_64 (Intel) and check it with grep hadolint-macos-arm64 checksums.sha256 | shasum -a 256 -c -. We did not run the Mac steps.
Check it worked. hadolint --version prints Haskell Dockerfile Linter 2.15.1 (we saw exactly this on Windows and Linux). Then hadolint Dockerfile (Windows: .\hadolint.exe .\Dockerfile) prints the same findings, with the file name instead of -.
Tip: Check the checksum even on a home server. A download is code you are about to run.
Read the report and choose what fails#
Hadolint prints every finding, whatever its severity. What decides the exit code is the failure threshold:
--failure-threshold | Exit code 1 when there is a finding of severity |
|---|---|
error | error |
warning | warning or error |
info (default) | info, warning or error |
style | style or anything above |
ignore or none | never because of findings |
The threshold hides nothing: with error the warnings still print, they just do not fail the run. The maintainer confirmed it in issue 821 (October 2026). We saw it too: a file with only warnings returned 0. We suggest warning to start: info lines are hints.
docker run --rm -i hadolint/hadolint:v2.15.1 hadolint --failure-threshold warning - < Dockerfile
Windows: Get-Content .\Dockerfile | docker run --rm -i hadolint/hadolint:v2.15.1 hadolint --failure-threshold warning -. With options you must name the program (hadolint) and add - for stdin: the image's default command is just hadolint -.
Output formats (--format): tty (default), json, checkstyle, codeclimate, gitlab_codeclimate, gnu, codacy, sonarqube, sarif and junit (new in v2.15.0). json suits scripts:
printf 'FROM debian\n' | docker run --rm -i hadolint/hadolint:v2.15.1 hadolint --format json -
[{"code":"DL3006","column":1,"file":"-","level":"warning","line":1,"message":"Always tag the version of an image explicitly"}]
Ten rules you will meet, with fixes#
The README calls its rule list "incomplete", so this is a pick, not a ranking. Severities are the README's defaults.
| Rule | Default | Problem | Fix |
|---|---|---|---|
| DL3006 / DL3007 | warning | No tag / tag latest | A release tag |
| DL3008 | warning | apt packages without versions | curl=8.5.* |
| DL3009 / DL3015 | info | apt lists left / extras installed | Delete lists in the same RUN; --no-install-recommends |
| DL3013 / DL3042 | warning | pip without pins / with cache | ==version or a requirements file; --no-cache-dir |
| DL3018 | warning | apk packages without versions | curl=~8.14 |
| DL3025 | warning | Shell-form CMD / ENTRYPOINT | JSON form |
| DL3059 | info | Several RUN lines in a row | Merge related ones |
| DL4006 | warning | Pipe in RUN without pipefail | A SHELL line |
| DL3003 / DL3020 | warning / error | cd in RUN / ADD for plain files | WORKDIR / COPY |
| SC2086 | ShellCheck | Unquoted variable | "$var" |
Tags and apt packages (DL3006 to DL3009, DL3015, DL3059). An untagged or latest image changes under you, and unpinned packages make two builds differ. The wiki on DL3009: "Clean up must be performed in the same RUN step, otherwise it will affect image size."
# Bad FROM ubuntu RUN apt-get update RUN apt-get install -y curl RUN apt-get clean && rm -rf /var/lib/apt/lists/* # Good (dummy version: check yours with: apt-cache madison curl) FROM ubuntu:24.04 RUN apt-get update \ && apt-get install -y --no-install-recommends curl=8.5.* \ && rm -rf /var/lib/apt/lists/*
Python and Alpine packages (DL3013, DL3042, DL3018, DL3045). A COPY to a relative path needs a WORKDIR first (DL3045).
# Bad FROM python:3.13-slim RUN pip install flask # Good (requirements.txt holds name==version lines) FROM python:3.13-slim WORKDIR /opt/app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt
# Bad FROM alpine:3.22 RUN apk add --no-cache curl # Good (dummy pin: any 8.14.x) FROM alpine:3.22 RUN apk add --no-cache curl=~8.14
The ~ form is kinder than an exact pin, which breaks the build once the package leaves the repository.
Start-up and directories (DL3025, DL3003, DL3020). The shell form of CMD starts your program under /bin/sh -c, which does not pass stop signals to it.
# Bad ADD config.txt /opt/ RUN cd /opt && ./setup.sh CMD python3 /opt/app.py # Good COPY config.txt /opt/ WORKDIR /opt RUN ./setup.sh CMD ["python3", "/opt/app.py"]
Pipes and quoting (DL4006, SC2086). Without pipefail, a RUN with a pipe succeeds if only the last command succeeds, so a failed download goes unnoticed.
# Bad RUN wget -qO- https://example.com/list.txt | wc -l > /count.txt # Good on Alpine (busybox ash); use ["/bin/bash", "-o", "pipefail", "-c"] on Debian or Ubuntu SHELL ["/bin/ash", "-eo", "pipefail", "-c"] RUN wget -qO- https://example.com/list.txt | wc -l > /count.txt
SC2086 comes from ShellCheck: RUN rm -rf /tmp/$DIR_NAME prints SC2086 info: Double quote to prevent globbing and word splitting. and RUN rm -rf "/tmp/$DIR_NAME" is clean. We ran every "good" snippet above on its own: no findings, exit code 0.
Step 3: Keep the settings in a .hadolint.yaml#
Hadolint reads the first config file it finds, without merging: .hadolint.yaml in the current folder, then a few places under your home folder (the README lists them). .yml works too, and --config <file> names one directly.
Linux#
cd ~/docker_volumes/hadolint/config
cat > .hadolint.yaml << 'EOF'
failure-threshold: warning
# Every ignore needs a reason. These two are dummy examples:
ignored:
- DL3008 # we pin the whole distro release, not each package
- DL3059 # separate RUN lines keep our build cache useful
trustedRegistries:
- docker.io
- registry.example.com:5000
override:
error:
- DL3002 # a root container is an error for us
EOF
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\hadolint\config"
@'
failure-threshold: warning
# Every ignore needs a reason. These two are dummy examples:
ignored:
- DL3008 # we pin the whole distro release, not each package
- DL3059 # separate RUN lines keep our build cache useful
trustedRegistries:
- docker.io
- registry.example.com:5000
override:
error:
- DL3002 # a root container is an error for us
'@ | Set-Content -Encoding ascii .hadolint.yaml
Mac (Terminal)#
Same commands as Linux.
What the keys do (from the README's schema):
| Key | Type | Meaning |
|---|---|---|
failure-threshold | one word | error, warning, info, style, ignore or none |
ignored | list | Rule ids to switch off |
override | error/warning/info/style lists | Change a rule's severity |
trustedRegistries | one name or a list | A FROM image from another registry gives DL3026. Wildcards like "*.gcr.io" are allowed |
disable-ignore-pragma | true/false | Switch off inline ignores (below) |
Environment variables such as HADOLINT_FAILURE_THRESHOLD=warning work too. On the command line, --ignore replaces the config file's ignored list instead of adding to it. Labels can be checked as well (label-schema in the README).
Check it worked. With the binary, run hadolint -V ../samples/Dockerfile in that folder. The first line says Configuration file used: with the path of your file. The sample then shows no DL3008 and no DL3059. (Docker route: next section.)
Ignore a rule on purpose, and use the config with Docker#
Ignore one instruction. A comment directly above it. The text after a second # is your reason:
# hadolint ignore=DL3018 # distro packages come from the pinned alpine release RUN apk add --no-cache curl
Ignore for a whole file. Put # hadolint global ignore=DL3018,DL3059 # reason before the first instruction. We tested both forms and they work as described.
Using the config with Docker. The image looks in its working directory, /. The maintainer says mounting the file at /.hadolint.yaml "works on all three image flavors" (issue 652). In the config folder run:
docker run --rm -i -v "$PWD/.hadolint.yaml:/.hadolint.yaml:ro" hadolint/hadolint:v2.15.1 < ../samples/Dockerfile
Get-Content ..\samples\Dockerfile | docker run --rm -i -v "$($PWD.Path)\.hadolint.yaml:/.hadolint.yaml:ro" hadolint/hadolint:v2.15.1
Mac: same as Linux. Or mount the whole project: Hadolint then finds the file itself and can lint several Dockerfiles at once (we ran it with two):
docker run --rm -v "$PWD:/work:ro" -w /work hadolint/hadolint:v2.15.1 hadolint Dockerfile other/Dockerfile
Check it worked. Add -V after the second hadolint (... hadolint:v2.15.1 hadolint -V -). We saw Configuration file used: /.hadolint.yaml and a list with our ignores and threshold. No such line means the file was not found.
Tip: An ignore without a reason is a trap for next year's you. Write why, and revisit the list after every Hadolint upgrade.
Lint in CI (Forgejo Actions and Woodpecker)#
Both examples fail the pipeline on a warning or an error. We did not run either pipeline.
Forgejo Actions. This job uses the runner label docker from our Forgejo guide (image node:20-bookworm), so we use actions/checkout@v4, which runs on Node 20. We download the binary and check its checksum instead of using a wrapper action. Save it as .forgejo/workflows/hadolint.yaml:
on: [push, pull_request]
jobs:
hadolint:
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Install Hadolint v2.15.1
run: |
set -eu
base=https://github.com/hadolint/hadolint/releases/download/v2.15.1
curl -fsSL -o hadolint-linux-x86_64 "$base/hadolint-linux-x86_64"
curl -fsSL -o checksums.sha256 "$base/checksums.sha256"
grep ' \*hadolint-linux-x86_64$' checksums.sha256 | sha256sum -c -
install -m 0755 hadolint-linux-x86_64 /usr/local/bin/hadolint
- name: Lint the Dockerfile
run: hadolint --failure-threshold warning Dockerfile
On an arm64 runner use hadolint-linux-arm64. The install lines work as written (we ran them in a Debian container). The project's hadolint-action (MIT, v3.5.0, 24 August 2026) needs Docker access from the runner; we did not test it on Forgejo.
Woodpecker CI. Woodpecker runs each step in a container and starts your commands with /bin/sh. The default Hadolint image is built FROM scratch and has no shell, so use the Debian image. Save as .woodpecker/hadolint.yaml:
when:
- event: [push, pull_request]
steps:
- name: hadolint
image: hadolint/hadolint:v2.15.1-debian
commands:
- hadolint --version
- hadolint --failure-threshold warning Dockerfile
We ran that image with /bin/sh -c, so shell and program are there. Our Woodpecker guide covers the server and agent.
Git hook. With the binary installed, pre-commit can run Hadolint before each commit. The repository ships two hooks, hadolint (uses your binary) and hadolint-docker (runs the project image, with no version pin in the hook):
repos:
- repo: https://github.com/hadolint/hadolint
rev: v2.15.1
hooks:
- id: hadolint
The official page still shows rev: v2.12.0; we used the current tag. We did not run pre-commit.
Put it behind HTTPS with Traefik? You do not need to#
Hadolint is a command, not a service: no port, no web page, nothing to put behind Traefik or Caddy. The project hosts a small online linter, but do not paste a real Dockerfile into any website: it can hold internal names.
With Traefik#
No labels or routes are needed.
Without Traefik: Caddy#
No reverse_proxy line is needed for the same reason. For browser tools, see our Traefik and Caddy guides, or Dockge and Komodo.
Security and testing#
| Control | How |
|---|---|
| No Docker socket | The container route needs only stdin. Never mount /var/run/docker.sock for Hadolint |
| No network | The linter needs none: docker run --rm -i --network none --read-only --cap-drop ALL ... worked for us |
| Pinned version | Pin the image tag or binary URL and check the checksum |
| Ignore comments | Anyone can silence a rule with a comment. For strict CI set disable-ignore-pragma: true (we saw it report a rule that a comment had hidden) |
| Secrets | Rule DL3064 (new in v2.15.0) warns about sensitive names in ARG and ENV. Lint is not a secret scanner |
A clean result does not make an image safe. Scan the built image too, with Trivy or Grype and Syft.
Quick test (on a Docker-only machine put docker run --rm -i hadolint/hadolint:v2.15.1 hadolint in front of the -):
echo 'FROM debian' | hadolint - echo "exit code: $?"
You should see DL3006 and exit code 1. printf 'FROM debian:12\n' | hadolint - prints nothing and returns 0.
Common mistakes#
| Mistake | Why it happens | Do this instead |
|---|---|---|
DL3009 Delete the apt-get lists after installing something although a last RUN cleans up (issue 311) | Files deleted in a later layer still sit in the earlier one | Install and delete in the same RUN |
failure-threshold: error still prints warnings (issue 821) | The threshold changes the exit code, not the output | Read the exit code, or filter --format json yourself |
expected severity instead of tag:yaml.org,2002:seq tagged sequence (issue 775) | failure-threshold was written as a list | One word: failure-threshold: warning. The list keys are ignored, trustedRegistries and the override levels |
DL3008 Pin versions in apt get install though the pins sit in a variable (issue 363) | Hadolint cannot expand every shell variable form (maintainer) | Pin on the apt-get install line, or ignore with a reason |
Quoting $buildDeps to silence SC2086 breaks apk: ERROR: 'curl' is not a valid child dependency (issue 427) | The variable is a list in one string | A bash array, or ignore SC2086 there with a reason |
DL4006 Set the SHELL option -o pipefail ... and no idea what to change (issue 724) | The fix is a line you have not written yet | Add the SHELL line from the rules section |
docker run ... < Dockerfile in PowerShell (issue 513) | PowerShell reserves < | Get-Content .\Dockerfile | docker run --rm -i hadolint/hadolint:v2.15.1 |
A config mounted at /root/.config/hadolint.yaml has no effect on the default image (issue 652) | That image does not search that path | Mount to /.hadolint.yaml |
A CI commands: step on the default image fails: exec: "/bin/sh": stat /bin/sh: no such file or directory (we reproduced it) | The default image is FROM scratch: no shell | Use the -debian tag |
AI assistants: hadolint --fix Dockerfile | They assume every linter fixes files | No such option exists (not in the README's help text). You edit |
AI assistants: docker run hadolint/hadolint Dockerfile | The file goes in on stdin: Docker took Dockerfile as the program (our run: exec: "Dockerfile.bad": executable file not found in $PATH) | docker run --rm -i hadolint/hadolint:v2.15.1 < Dockerfile |
AI assistants: the tag hadolint/hadolint:2.15.1 or :latest | The tag has a v, and latest moves | v2.15.1. Without the v: docker.io/hadolint/hadolint:2.15.1: not found |
Tip: Run Hadolint again right after each fix. Rules interact: replacing
cdbyWORKDIRcan reveal DL3045 (relativeCOPYwithoutWORKDIR).
Tip: When a rule seems wrong, read its wiki page: DL3059 says you "might want to ignore this info level rule" when caching matters more.
Tip: Do not copy someone else's ignore list. Start with an empty one and ignore only what you understand.
Troubleshooting#
| Problem | Solution |
|---|---|
| Config seems ignored | Add -V and read the Configuration file used: line. In Docker, mount to /.hadolint.yaml |
| Mount ignored in Git Bash on Windows | We saw this: Git Bash rewrites the path. Use PowerShell with $($PWD.Path), or set MSYS_NO_PATHCONV=1 |
Error parsing your config file in ... | Hadolint prints it and then still lints with the defaults. Read the first lines of the output |
| Different results in CI and at home | Different versions: pin the same one |
unexpected carriage return expecting '\' (issue 438) | A 2020 Windows line-ending bug, fixed. Windows line endings linted fine for us in v2.15.1 |
Known bugs (open, December 2026)#
- Issue 1285:
format: sarifin the config plus--format sarifon the command line writes two reports into one file. Set the format in one place. - Issue 1287: a false DL3066 when
USERuses a variable from a one-lineARG A B. Use oneARGper line. - Issue 984: SC2086 is not reported for a variable from an
ARG. We saw the same, so a clean result does not prove your quoting is right.
Updates and backups#
Update Hadolint. Read the release notes. New versions add rules (v2.15.0 added DL3063, DL3064, DL3066 and more), so a clean file can get new findings. Change the pinned tag or URL and lint everything once before you raise the CI threshold.
docker pull hadolint/hadolint:v2.15.1 docker run --rm hadolint/hadolint:v2.15.1 hadolint --version
Binary: repeat Step 2 with the new number. Homebrew: brew upgrade hadolint. Scoop: scoop update hadolint.
What to back up. Hadolint keeps no data. Your .hadolint.yaml and Dockerfiles belong in Git, and the Git server is the backup (for volumes of other apps see our docker-volume-backup guide). A practice folder can be saved like this:
Linux and Mac#
mkdir -p ~/docker_volumes/hadolint/backups tar -czf ~/docker_volumes/hadolint/backups/hadolint-$(date +%F).tar.gz -C ~/docker_volumes/hadolint config samples
Windows (PowerShell)#
New-Item -ItemType Directory -Force "$HOME\docker_volumes\hadolint\backups" | Out-Null tar.exe -czf "$HOME\docker_volumes\hadolint\backups\hadolint-$(Get-Date -Format yyyy-MM-dd).tar.gz" -C "$HOME\docker_volumes\hadolint" config samples
A schedule is not worth it here. Restore test: unpack the archive into an empty folder and lint again. You must get the same findings and the same exit code.
tar -xzf hadolint-<date>.tar.gz docker run --rm -i hadolint/hadolint:v2.15.1 < samples/Dockerfile
Performance and resources#
Hadolint parses text: no database, no network. We measured no RAM or CPU, and the docs give no figure. The default image is about 12 MB compressed (amd64), the Debian variant about 42 MB. With Docker most of the time goes into starting the container, so lint many files in one run or use the binary.
FAQ#
Does Hadolint build or change my image? No. It reads the Dockerfile and prints findings. There is no --fix.
Does it replace Trivy? No. Hadolint checks how you wrote the Dockerfile. Trivy and Grype and Syft look for known holes inside the finished image. Use both.
Which rules should I ignore? None at the start. Ignore a rule when you understand it and have a reason, such as DL3008 when you pin the whole distro release.
VS Code or Podman? The community extension vscode-hadolint (1.2.0, 4 October 2026) runs the binary from your PATH; we did not try it. The README shows podman run --rm -i docker.io/hadolint/hadolint < Dockerfile (see our Podman guide).
Sources#
- Hadolint repository and README at tag v2.15.1; releases v2.15.1 (31 July 2026) and v2.15.0 (30 July 2026); LICENSE (GPL-3.0)
- Rule wiki and ShellCheck SC2086
- Integration guide, pre-commit hooks, image Dockerfile and Docker Hub tags (API checked:
v2.15.1exists,2.15.1returns 404) - Forgejo workflow reference; Woodpecker workflow syntax at v3.20.1; hadolint-action (MIT)
- Homebrew formula and Scoop manifest, both at 2.15.1 on 3 December 2026
- Issues read: 311, 363, 427, 438, 513, 652, 724, 775, 821, 984, 1217, 1278, 1285, 1287
Checked against the official docs on 2026-12-03. The commands marked as tested in "Before you start" were run by DIY Lab Hub that day; the rest comes from the docs, the source and the issues above.