Sonar-scanner-cli:5 Docker image fails on ARM64 (aarch64) — container exits

Title: sonar-scanner-cli:5 Docker image fails on ARM64 (aarch64) — container exits immediately


Versions

  • SonarQube: SonarCloud
  • Scanner: sonarsource/sonar-scanner-cli:5 (Docker)
  • Jenkins Sonar Plugin: SonarQube Scanner for Jenkins (via withSonarQubeEnv)
  • Host: AWS EC2 Graviton3 (m7g instance, aarch64)

Deployment

SonarCloud (cloud-hosted). Scanner runs as a Docker container launched by the Jenkins pipeline via the docker.image(…).inside {} pattern on an ARM64 Jenkins worker node.

What I’m trying to achieve

Run sonar-scanner-cli:5 as a Docker container on an ARM64 (aarch64) AWS Graviton Jenkins agent as part of a CI pipeline.

What happened

The image pulls successfully from Docker Hub (Docker resolves the :5 tag), but the container exits immediately without running. Jenkins then reports:

ERROR: Build Failed
java.io.IOException: Failed to run top ‘’.
Error: Error response from daemon: container is not running

And SonarQube quality gate check reports:
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?

What I’ve tried

  • Confirmed the issue is architecture-specific: the same pipeline runs successfully on x86_64 Jenkins agents
  • Confirmed Docker pulls the image without error on the ARM64 host — the failure is at container startup (exec format error / wrong arch binary)
  • Checked Docker Hub: sonarsource/sonar-scanner-cli:5 does not appear to publish an linux/arm64 manifest entry

Question

Is there an official ARM64-compatible sonar-scanner-cli image or tag? If not, is there a recommended workaround (e.g., a specific tag that includes an arm64 manifest, or an alternative installation method for ARM64 agents)?

The Root Cause: Missing ARM64 Docker Support

The “container exits immediately” issue on your Graviton node is happening because there is no official linux/arm64 image for sonarsource/sonar-scanner-cli on Docker Hub.

Currently, SonarSource only publishes linux/amd64 images. When your Jenkins pipeline uses .inside {} on an ARM64 worker, Docker pulls the x86_64 image. The moment Jenkins tries to execute the container’s entrypoint or the scanner’s Java/Node.js binaries, it hits an architecture mismatch (exec format error) and the container instantly crashes and exits.

How to Fix It / Workarounds:

Since you cannot run the official Docker image natively on Graviton, you have two primary options:

Option 1: Run the Scanner directly on the host (No Docker)

While the Docker image doesn’t support ARM64, the underlying SonarScanner CLI binary itself DOES support ARM64. The cleanest fix is to bypass Docker entirely and run the scanner natively on your Jenkins worker.

If you have the SonarQube Scanner configured in Jenkins Global Tool Configuration, you can do this:

Groovy

def scannerHome = tool 'SonarQube Scanner'
withSonarQubeEnv('SonarCloud') {
    sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=my-project"
}

(Note: Ensure your Jenkins worker has Java 17 installed, as it’s required to run the v5 scanner).

Option 2: Build a custom ARM64 Docker Image

If your pipeline strictly requires a containerized environment, you can easily build your own ARM64 scanner image using the official binaries.

Create a Dockerfile based on an ARM64 Java image:

Dockerfile

FROM amazoncorretto:17-alpine
RUN apk add --no-cache nodejs npm git
ENV SONAR_SCANNER_VERSION=5.0.1.3006
RUN wget -O /tmp/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip && \
    unzip /tmp/sonar-scanner.zip -d /opt && \
    rm /tmp/sonar-scanner.zip && \
    mv /opt/sonar-scanner-${SONAR_SCANNER_VERSION}-linux /opt/sonar-scanner
ENV PATH="/opt/sonar-scanner/bin:${PATH}"
ENTRYPOINT ["sonar-scanner"]

Build this image (docker build -t my-repo/sonar-scanner-arm64:5 .), push it to your registry, and point your Jenkins pipeline’s docker.image() block to it instead of the official SonarSource one.