Using SonarCloud GitHub Action in a C++ project Docker build

I would like to use the SonarCloud GitHub Action in a C++ project that requires Docker for building. The problem is that the SonarCloud GitHub Action itself launches a Docker container, so as far as I can see, a Docker-in-Docker (DinD) solution is needed.

The C++ project requires large Qt and OpenSSL development packages, so running it outside Docker is infeasible as GitHub Action VMs do not cache packages.

I envision the following steps:

  • run the job in a Docker container:
    runs-on: ubuntu-latest
    container: mrts/qt-cmake-gtest-valgrind-ubuntu:v1.8
  • checkout code with actions/checkout
  • run cmake to create the Makefile
  • run build-wrapper-linux-x86-64 make to run the build and gather all the information required for analysis
  • run the analysis with SonarSource/sonarcloud-github-action using the output of the previous step.

Do you have any recommendations for this situation?

Hi @mrts,


Instead of using this action run manually sonar-scanner (not the docker version) right after the build from within the container where you run the build.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.