Sonarqube will not start in docker container

Latest version of sonarqube from docker hub.

I want to get sonarqube running in a container.

I’m a docker newbie which isnt helping.

Using the command on the sonarqube getting started page:
docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest

The following appears in the log:


[o.s.s.q.ProjectsInWarningDaemon] Counting number of projects in warning will be disabled as there are no more projects in warning.
2022.01.12 11:42:17 INFO  app[][o.s.a.SchedulerImpl] Process[web] is up
2022.01.12 11:42:17 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='ce', ipcIndex=3, logFilenamePrefix=ce]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-9.2.4.50792.jar:/opt/sonarqube/lib/jdbc/h2/h2-1.4.199.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process9968817034567357693properties
2022.01.12 11:42:17 WARN  app[][startup] ####################################################################################################################
2022.01.12 11:42:17 WARN  app[][startup] Default Administrator credentials are still being used. Make sure to change the password or deactivate the account.
2022.01.12 11:42:17 WARN  app[][startup] ####################################################################################################################
2022.01.12 11:42:17 INFO  web[][o.s.s.p.Platform] WebServer is operational
2022.01.12 11:42:17 INFO  ce[][o.s.p.ProcessEntryPoint] Starting ce
2022.01.12 11:42:17 INFO  ce[][o.s.ce.app.CeServer] Compute Engine starting up...
2022.01.12 11:42:17 INFO  ce[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [http://localhost:9001]
2022.01.12 11:42:18 INFO  ce[][o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://127.0.0.1:9092/sonar
2022.01.12 11:42:18 WARN  ce[][o.s.db.dialect.H2] H2 database should be used for evaluation purpose only.
2022.01.12 11:42:18 INFO  ce[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
2022.01.12 11:42:19 INFO  ce[][o.s.c.c.CePluginRepository] Load plugins
2022.01.12 11:42:19 INFO  ce[][o.s.c.c.ComputeEngineContainerImpl] Running Community edition
2022.01.12 11:42:19 INFO  ce[][o.s.ce.app.CeServer] Compute Engine is operational
2022.01.12 11:42:19 INFO  app[][o.s.a.SchedulerImpl] Process[ce] is up
2022.01.12 11:42:19 INFO  app[][o.s.a.SchedulerImpl] SonarQube is up
2022.01.12 11:42:25 INFO  web[][o.a.c.h.Http11Processor] Error parsing HTTP request header\n Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name [0x160x030x010x020x000x010x000x010xfc0x030x030x9c0xbdS0xa80x7f,0xb20xc90x93hb0x0d0x8f0xc60xf93LL0xf1 ]. HTTP method names must be tokens
    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:434)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:511)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1650)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:829)
2022.01.12 11:42:25 INFO  web[][o.a.c.h.Http11Processor] Error parsing HTTP request header\n Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name [0x160x030x010x020x000x010x000x010xfc0x030x030x0c0xf80x070x0e0xa10xa30x880xc20xa0.0xdd0x9c0x8a0x15iO0xbfQ90x140xd30x940xea&0xd6\0xde0x09j0xa20xcd0xa1 ]. HTTP method names must be tokens
    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:434)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:511)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1650)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:829)

No Idea how to fix it.

If I create my own docker compose file and pull latest and run that, I get this:

2022.01.12 11:58:41 INFO  es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /opt/sonarqube/logs/sonarqube.log
2022.01.12 11:58:41 INFO  es[][o.e.n.Node] stopping ...
2022.01.12 11:58:41 INFO  es[][o.e.n.Node] stopped
2022.01.12 11:58:41 INFO  es[][o.e.n.Node] closing ...
2022.01.12 11:58:41 INFO  es[][o.e.n.Node] closed
2022.01.12 11:58:41 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 78
2022.01.12 11:58:41 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2022.01.12 11:58:41 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

None of which I can work out how to fix or find anything on the internet to help. Fingers crossed someone can.

Cheers

Hi @scottkirwamthomas and welcome to the community :wave:

From the first logs it looks like sonarqube starts up just fine and you have an issue in the connection in between the application and your browser (maybe a proxy or other kind of security software?) that is sending https packages to sonarqube which can only understand http. Maybe something to check.

Your second error comes from the docker host not meeting the requirements as documented here: Prerequisites and Overview | SonarQube Docs

Hope that helps

I’ll look at the first attempt as to why its trying https. As for the second, I understand the solution is to execute this: sysctl -w vm.max_map_count=262144.

What I cant find is how to do that. I’m launching the containers from a docker compose file. The tinternet says I should run the command in the cli of the container however the container doesnt start so I cant use the cli?

The command sysctl -w vm.max_map_count=262144 should be executed on the docker host and not in the container

My host is a windows machine so how can I execute that?

For anyone else that has this problem, what’s not obvious is that the commands need to be run against wsl on your windows machine.

Opening a command prompt and running:

‘wsl -d docker-desktop’

Allows you to execute the ‘sysctl -w vm.max_map_count=262144’ against the host machine.

1 Like

My next problem is the same as the first in this thread, the browser is trying to use https not http and I cant stop if from forcing https. Any ideas?

Found the answer.

If you take a look here, it tells you how to fix the issue. I’m using edge and swapped chrome for edge in the url.

Finally up and running happy days

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