Skip to content

cpp-linter/clang-tools-docker

Repository files navigation

🐳 Clang Tools Docker image

Docker Pulls Docker Image Size CI Docker Scout slsa-badge cpp-linter hub

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.

Used By

LLNL LLNL   CLEARSY CLEARSY   Mumble Mumble   AutoBleem AutoBleem   ValeevGroup ValeevGroup   ada-url ada-url   and many more.

Supported Tags and Dockerfile links

Supply Chain Security

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.

Verify image signature

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:22

Download SBOM

cosign download sbom xianpengshen/clang-tools:22

Or use docker buildx imagetools inspect:

docker buildx imagetools inspect xianpengshen/clang-tools:22 --format '{{ json .SBOM }}'

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

Have question or feedback?

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

License

Apache License

Sponsor this project

 

Packages

 
 
 

Contributors