Build C++ programs and check test coverage and memory use.
1.3K
Build C++ programs and check test coverage and memory use.
This image uses the official GCC base image.
It includes g++, CMake, Git, gcovr, lcov, Valgrind, and tree.
Use it for C++ builds, coverage reports, and memory checks.
When you mount your project, set the working directory with -w.
| Tag | Meaning | Platform |
|---|---|---|
latest | Latest successful build from main | linux/amd64 |
The latest tag changes after a new build passes its tests.
See all tags and digests.
Build and check a program from main.cpp in your current directory:
docker pull stden/cpp:latest
docker run --rm -v "$PWD":/workspace -w /workspace stden/cpp:latest \
bash -c 'g++ --coverage -g -O0 main.cpp -o app && ./app && gcovr --root . && valgrind --error-exitcode=1 ./app'
For a CMake project:
docker run --rm -v "$PWD":/workspace -w /workspace stden/cpp:latest \
bash -c 'cmake -S . -B build && cmake --build build && ctest --test-dir build --output-on-failure'
The image does not include project libraries. Install extra dependencies in a child image.
For example, if your project uses Boost.Filesystem, add libboost-filesystem-dev.
Build output and coverage files stay in the mounted project directory.
Files that the container creates belong to root.
The smoke test compiles a C++ program with coverage enabled. It runs the program, generates a gcovr report, and runs Valgrind with an error exit code.
Content type
Image
Digest
sha256:b4fd0f873…
Size
622.3 MB
Last updated
1 day ago
docker pull stden/cpp