🐳 The Clang Tools Docker image includes the clang-format and clang-tidy.
You can find all the clang-tools Docker images on Docker Hub registry or GitHub Packages registry.
all
(Supported versions of clang-tools includes18
,17
,16
,15
,14
,13
,12
,11
,10
,9
)18
17
16
16-alpine
15
14
13
12
11
10
9
8
7
# Check clang-format version
$ docker run xianpengshen/clang-tools:17 clang-format --version
Ubuntu clang-format version 17.0.0 (+rc4-1~exp5ubuntu1)
# Format code (helloworld.c in the demo directory)
$ docker run -v $PWD:/src xianpengshen/clang-tools:17 clang-format --dry-run -i helloworld.c
# Check clang-tidy version
$ docker run xianpengshen/clang-tools:17 clang-tidy --version
Ubuntu LLVM version 17.0.0
Optimized build.
# Diagnostic code (helloworld.c in the demo directory)
$ docker run -v $PWD:/src xianpengshen/clang-tools:17 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.0 (+rc4-1~exp5ubuntu1)
# Format code
$ docker run clang-tools clang-format --dry-run -i helloworld.c
# Check clang-tidy version
$ docker run clang-tools clang-tidy --version
Ubuntu LLVM version 17.0.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.