Failed to run sonarqube by docker-compose.yml

Goal: Run a local sonar server.
Step: By docker-compose.yml.
Error:

❯ docker compose up
[+] Running 3/3
 ⠿ Network sonar_default        Created                                                                                                                                                 0.0s
 ⠿ Container sonar-db-1         Created                                                                                                                                                 0.1s
 ⠿ Container sonar-sonarqube-1  Created                                                                                                                                                 0.1s
Attaching to sonar-db-1, sonar-sonarqube-1
sonar-db-1         |
sonar-db-1         | PostgreSQL Database directory appears to contain a database; Skipping initialization
sonar-db-1         |
sonar-db-1         | 2021-11-11 09:09:09.096 UTC [1] LOG:  starting PostgreSQL 12.8 (Debian 12.8-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
sonar-db-1         | 2021-11-11 09:09:09.099 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
sonar-db-1         | 2021-11-11 09:09:09.099 UTC [1] LOG:  listening on IPv6 address "::", port 5432
sonar-db-1         | 2021-11-11 09:09:09.102 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
sonar-db-1         | 2021-11-11 09:09:09.166 UTC [61] LOG:  database system was interrupted; last known up at 2021-11-11 09:07:47 UTC
sonar-db-1         | 2021-11-11 09:09:09.338 UTC [61] LOG:  database system was not properly shut down; automatic recovery in progress
sonar-db-1         | 2021-11-11 09:09:09.342 UTC [61] LOG:  redo starts at 0/164E7A8
sonar-db-1         | 2021-11-11 09:09:09.342 UTC [61] LOG:  invalid record length at 0/164E7E0: wanted 24, got 0
sonar-db-1         | 2021-11-11 09:09:09.343 UTC [61] LOG:  redo done at 0/164E7A8
sonar-db-1         | 2021-11-11 09:09:09.375 UTC [1] LOG:  database system is ready to accept connections
sonar-sonarqube-1  | Dropping Privileges
sonar-sonarqube-1  | 2021.11.11 09:09:12 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
sonar-sonarqube-1  | 2021.11.11 09:09:12 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:43553]
sonar-sonarqube-1  | 2021.11.11 09:09:13 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
sonar-sonarqube-1  | 2021.11.11 09:09:13 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
sonar-sonarqube-1  | 2021.11.11 09:09:23 WARN  es[][o.e.b.JNANatives] unable to install syscall filter:
sonar-sonarqube-1  | java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:331) ~[elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:606) ~[elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:248) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:102) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:108) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:399) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116) [elasticsearch-cli-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.cli.Command.main(Command.java:79) [elasticsearch-cli-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81) [elasticsearch-7.14.1.jar:7.14.1]
sonar-sonarqube-1  | 2021.11.11 09:09:25 INFO  es[][o.e.n.Node] version[7.14.1], pid[74], build[default/tar/66b55ebfa59c92c15db3f69a335d500018b3331e/2021-08-26T09:01:05.390870785Z], OS[Linux/5.10.47-linuxkit/amd64], JVM[Alpine/OpenJDK 64-Bit Server VM/11.0.11/11.0.11+9-alpine-r0]
sonar-sonarqube-1  | 2021.11.11 09:09:25 INFO  es[][o.e.n.Node] JVM home [/usr/lib/jvm/java-11-openjdk]
sonar-sonarqube-1  | 2021.11.11 09:09:25 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseG1GC, -Djava.io.tmpdir=/opt/sonarqube/temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=COMPAT, -Des.enforce.bootstrap.checks=true, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Dbootstrap:system_call_filter=false, -Des.path.home=/opt/sonarqube/elasticsearch, -Des.path.conf=/opt/sonarqube/temp/conf/es, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=false]

Env:

❯ sw_vers
ProductName:	macOS
ProductVersion:	12.0.1
BuildVersion:	21A559

docker-compose.yml:

❯ cat docker-compose.yml
version: "3"

services:
    sonarqube:
        image: sonarqube:community
        platform: linux/x86_64
        depends_on:
            - db
        environment:
            SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
            SONAR_JDBC_USERNAME: sonar
            SONAR_JDBC_PASSWORD: sonar
            SONAR_SEARCH_JAVAADDITIONALOPTS: "-Dbootstrap:system_call_filter=false"
        volumes:
            - sonarqube_data:/opt/sonarqube/data
            - sonarqube_extensions:/opt/sonarqube/extensions
            - sonarqube_logs:/opt/sonarqube/logs
        ports:
            - "9000:9000"
    db:
        image: postgres:12
        platform: linux/x86_64
        environment:
            POSTGRES_USER: sonar
            POSTGRES_PASSWORD: sonar
        volumes:
            - postgresql:/var/lib/postgresql
            - postgresql_data:/var/lib/postgresql/data

volumes:
    sonarqube_data:
    sonarqube_extensions:
    sonarqube_logs:
    postgresql:
    postgresql_data:

I have already followed this instruction. But it doesn’t work.

Any progress?
BTW, the compose file works well on the Ubuntu 21.10.

Hi @pplmx and welcome to the community :wave:

sorry for the delay on answering your post.

try with a . instead of a :

SONAR_SEARCH_JAVAADDITIONALOPTS: "-Dbootstrap.system_call_filter=false"

as you probably understand by now these checks are there for a reason and i would recommend to use ubuntu or any other linux distribution that comes with a kernel that supports seccomp to run SonarQube in production.

hope that helps

1 Like

Thanks @Tobias_Trabelsi. It works fine. :smiley:

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