Docker images with clang-format, clang-tidy and the other clang tools, tagged by LLVM version. LLVM 12 and later come from the cpp-linter static binaries, so every image of a version carries exactly the same release.
Website 路 GitHub Packages 路 Docker Hub 路 Get started 路 Discussions
docker pull ghcr.io/cpp-linter/clang-tools:21
docker run --rm -v "$PWD":/src ghcr.io/cpp-linter/clang-tools:21 clang-format --dry-run --Werror /src/main.cppEvery image is pushed to two registries, with the same digest, and both copies are signed:
ghcr.io/cpp-linter/clang-toolson GitHub Packages is the recommended address. It belongs to the cpp-linter organization and is not subject to Docker Hub's pull rate limits.xianpengshen/clang-toolson Docker Hub keeps receiving every image, so pipelines that already use it do not need to change.
# Check clang-format version
$ docker run ghcr.io/cpp-linter/clang-tools:19 clang-format --version
clang-format version 19.1.7
# Format code (helloworld.c in the demo directory)
$ docker run -v $PWD:/src ghcr.io/cpp-linter/clang-tools:19 clang-format -i helloworld.c
# Check clang-tidy version
$ docker run ghcr.io/cpp-linter/clang-tools:19 clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 19.1.7
Optimized build.
# Diagnostic code (helloworld.c in the demo directory)
$ docker run -v $PWD:/src ghcr.io/cpp-linter/clang-tools:19 clang-tidy helloworld.c \
'-checks=boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-cplusplus-*,clang-analyzer-*,cppcoreguidelines-*'FROM ghcr.io/cpp-linter/clang-tools:17
WORKDIR /src
COPY . .
CMD [ "" ]Then build and run the Docker image:
$ docker build -t clang-tools .
# Check clang-format version
$ docker run clang-tools clang-format --version
clang-format version 17.0.6
# Format code
$ docker run clang-tools clang-format -i helloworld.c
# Check clang-tidy version
$ docker run clang-tools clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 17.0.6
Optimized build.
# Diagnostic code
$ docker run clang-tools clang-tidy helloworld.c \
'-checks=boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-cplusplus-*,clang-analyzer-*,cppcoreguidelines-*'All images listed here support linux/amd64 and linux/arm64 platforms.
Each tag below exists in both registries (see Registries).
all(versions21,20,19,18,17,16,15,14,13,12,11,10,9from Ubuntu's packages; run them asclang-format-21,clang-tidy-21and so on)23,23.1.322,22.1.821,21.1.820,20.1.819,19.1.718,18.1.817,17.0.616,16.0.615,15.0.714,14.0.613,13.0.112,12.0.1
A major-version tag such as 22 moves to each new patch release; a full-version tag such as 22.1.8 always carries that LLVM release. Every tag is rebuilt each week to pick up the base image's security updates, so pin a digest if you need a byte-for-byte identical image.
These tags stay in both registries and can still be pulled, but they are no longer rebuilt and get no security updates:
11,10,9,8,7(Ubuntu'sclang-format-Nandclang-tidy-Npackages; 7 to 10 on Ubuntu 20.04, which has reached end of standard support).16-alpineto22-alpine: all seven carry clang-format and clang-tidy 16.0.6 from Alpine 3.18, whatever the number in the tag.
Use a tag from the list above instead, such as 22 in place of 22-alpine.
Tags 12 to 23 (Ubuntu 22.04 for 12 and 13, Ubuntu 24.04 for 14 to 18, Ubuntu 26.04 for 19 and later) contain:
clang-format,clang-tidy,clang-apply-replacements,clang-query,clang-scan-depsand, from LLVM 18,clang-include-cleaner, each also as<tool>-<major>(for exampleclang-tidy-22);- clang's builtin headers, plus the C and C++ standard library headers (
libc6-devand the distribution's defaultlibstdc++-dev), so clang-tidy can parse code; run-clang-tidy,clang-tidy-diff-<major>.py,clang-format-diff-<major>andgit-clang-formatfrom the same LLVM release, with Python 3 to run them.
They do not contain the clang compiler or git. The all tag still installs Ubuntu's clang-format-N and clang-tidy-N packages.
All images are signed with cosign (keyless, via GitHub Actions OIDC) and come with an SBOM (Software Bill of Materials, SPDX format) generated by Syft. They also carry a SLSA provenance attestation from the build.
cosign verify \
--certificate-identity-regexp 'https://github.com/cpp-linter/clang-tools-docker/.github/workflows/CI.yml@refs/heads/main' \
--certificate-oidc-issuer 'https://token.actions.githubusercontent.com' \
ghcr.io/cpp-linter/clang-tools:22docker buildx imagetools inspect ghcr.io/cpp-linter/clang-tools:22 --format '{{ json .SBOM }}'
docker buildx imagetools inspect ghcr.io/cpp-linter/clang-tools:22 --format '{{ json .Provenance }}'See the contributing guide and open an issue for bugs and feature requests.
This project is licensed under the Apache License 2.0 with LLVM Exceptions.