Docker images with Ubuntu's clang-format and clang-tidy packages, tagged by LLVM major version.
Website · Docker Hub · Get started · Discussions
docker pull xianpengshen/clang-tools:21
docker run --rm -v "$PWD":/src xianpengshen/clang-tools:21 clang-format --dry-run --Werror /src/main.cpp# Check clang-format version
$ docker run xianpengshen/clang-tools:19 clang-format --version
Ubuntu clang-format version 19.1.7 (20ubuntu4)
# Format code (helloworld.c in the demo directory)
$ docker run -v $PWD:/src xianpengshen/clang-tools:19 clang-format -i helloworld.c
# Check clang-tidy version
$ docker run xianpengshen/clang-tools:19 clang-tidy --version
Ubuntu LLVM version 19.1.7
Optimized build.
# Diagnostic code (helloworld.c in the demo directory)
$ docker run -v $PWD:/src xianpengshen/clang-tools:19 clang-tidy helloworld.c \
'-checks=boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-cplusplus-*,clang-analyzer-*,cppcoreguidelines-*'FROM xianpengshen/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
Ubuntu clang-format version 17.0.6 (9ubuntu1)
# Format code
$ docker run clang-tools clang-format -i helloworld.c
# Check clang-tidy version
$ docker run clang-tools clang-tidy --version
Ubuntu 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.
You can access all available Clang Tools Docker images via Docker Hub registry or GitHub Packages registry.
all(versions21,20,19,18,17,16,15,14,13,12,11,10,9; run them asclang-format-21,clang-tidy-21and so on)2221201918171615141312111098716-alpineto22-alpine: all seven carry clang-format and clang-tidy 16.0.6 from Alpine 3.18, whatever the number in the tag. For any other version, use the tag without-alpine.
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' \
xianpengshen/clang-tools:22docker buildx imagetools inspect xianpengshen/clang-tools:22 --format '{{ json .SBOM }}'
docker buildx imagetools inspect xianpengshen/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.