This Docker image comes pre-installed with essential clang tools, including clang-format and clang-tidy.
All images support linux/amd64 and linux/arm64 platforms.
You can access all available Clang Tools Docker images via Docker Hub registry or GitHub Packages registry.
LLNL
CLEARSY
Mumble
AutoBleem
ValeevGroup
ada-url
and many more.
all(Supports versions of clang-tools includes21,20,19,18,17,16,15,14,13,12,11,10,9)2222-alpine2121-alpine2020-alpine1919-alpine1818-alpine1717-alpine1616-alpine151413121110987
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.
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:22cosign download sbom xianpengshen/clang-tools:22Or use docker buildx imagetools inspect:
docker buildx imagetools inspect xianpengshen/clang-tools:22 --format '{{ json .SBOM }}'# Check clang-format version
$ docker run xianpengshen/clang-tools:19 clang-format --version
Ubuntu clang-format version 19.1.0 (1ubuntu1)
# 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.0
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-*As base image in Dockerfile
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.2 (1~exp1ubuntu2.1)
# 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 19.1.0
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-*To provide feedback (requesting a feature or reporting a bug) please post to issues.