Skip to content

cpp-linter/clang-tools-docker

Repository files navigation

Clang Tools Docker image

Docker Pulls GitHub Repo Maintenance CI Snyk Container

🐳 Clang Tools Docker Image: This Docker image comes pre-installed with essential clang tools, including clang-format and clang-tidy.

You can access all available Clang Tools Docker images via Docker Hub registry or GitHub Packages registry.

Supported Tags and Dockerfile links

How to use clang-tools Docker images

Docker run image

# 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 --dry-run -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:19

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 --dry-run -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-*

Have question or feedback?

To provide feedback (requesting a feature or reporting a bug) please post to issues.

License

Apache License