An example of how to run a SonarQube webapp instance using Docker on an M1 Mac
3.7K
Clone this docker build on your M1 Mac, and run it, making sure to use a port number (like 9000 below) for the Sonar web server.
Then go to the URL: http://localhost:9000/

You can find their nice, 2 minute guide here. But, on an M1 you can only run it locally using the source zip file. I really wanted to use Docker, which is their preferred method anyway.
It didn't work out of the box because you immediately get this error when building:
no matching manifest for linux/arm64/v8 in the manifest list entries
So, they don't have the right manifest for this architecture. You can force it to run in x86_64 mode:
docker run --platform linux/x86_64 sonarqube
But surprise, surprise, of course that doesn't work. You'll get a big error dump talking about Elasticsearch failing and other stuff:
unable to install syscall filter
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
etc. etc.
After further investigation, it turns out that this is something SonarQube isn't really working on, but there's definitely requests for it.
After SonarQube gave the simple response that "we don't support M1" another developer created a solution. This was great, but after trying to pull down mwizner's Docker, I got this error:
Error response from daemon: manifest for mwizner/sonarqube:latest not found: manifest unknown: manifest unknown
Also, mwizner's solution was for v8 of SonarQube, from almost a year ago, and I'm greedy and wanted the latest v9 to work (which matches the SonarQube version my team is using).
A big thanks to my colleague Chris Watts for helping me with this, because I'm a beginner at Docker and was going down the wrong path of trying to containerize SonarQube's source web app manually. I knew the source code worked without Docker for sure, but I didn't understand how to get Docker to work with specific architectures.
This file was the starting point, provided by mwizner's original solution. Chris provided changes to this in some key places:
FROM arm64v8/alpine:3.14.3
and
ZLIB_URL="https://mirrors.dotsrc.org/archlinuxarm/arm/core/zlib-1%3A1.2.11-5-arm.pkg.tar.xz";
ARG SONARQUBE_VERSION=9.3.0.51899
Docker stop, you're telling Docker to send a signal to the container to stop. By default, this command is SIGTERM, but some apps may be configured to listen to something else like SIGUSR1. Therefore, this command was added to manually make sure that SIGINT is sent to the container upon stopping. This is more of a QoL update, and is explained more here.STOPSIGNAL SIGINT
ENTRYPOINT ["/opt/sonarqube/bin/run.sh"]
CMD ["/opt/sonarqube/bin/sonar.sh"]
docker run -p9000:9000 sonarqubem1
Once again, thank you to Chris Watts for helping me with this! If you want to talk with us about Docker, check out Bravo LT's Discord server here!
Content type
Image
Digest
Size
323.8 MB
Last updated
over 4 years ago
docker pull davealdon/sonarqube-with-docker-and-m1-macs