I am trying to run sonarqube in a docker container. Container fails on startup with error “[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]”. The docker host is Windows server 2019 Version 1809 with Docker Engine version 19.03.12 (experimental mode enabled) and does not use Docker for Windows.
To fix the error i have tried:
setting higher ulimits using sysctl on the container but get error sysctl: setting key “fs.file-max”: Read-only file system. Using --privileged flag does not help. Get error C:\Program Files\Docker\docker.exe: Error response from daemon: Windows does not support privileged mode.
setting ulimits by adding default-ulimits to the docker run command but get error C:\Program Files\Docker\docker.exe: Error response from daemon: invalid option: Windows does not support Ulimits.
this is a rather uncommon combination. have you had a look at this blog post? you might be able to set the limit using net config server but i am no expert on windows
tbh i would shoot for a native installation if you have to stick to windows or use a real linux server for your sonarqube installation.
this said: there is a environment variable where you can disable the elasticsearch startup checks: SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true .
again not recommended but this would allow you to start sonarqube in this specific environment.
Hi Tobias, thanks for your answer. I tried the disable variable already, but that doesn’t seem to have any effect:
2020.10.16 11:45:14 INFO es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
Btw when I start the container without a linked database (so with the H2 evaluation database), then it starts without a problem (it gives the same messages in the log but as WARN instead of ERROR).
My docker run command:
docker run --name sonarqube -v sonarqube_extensions:/opt/sonarqube/extensions -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -e SONARQUBE_JDBC_USERNAME=*** -e SONARQUBE_JDBC_PASSWORD=*** -e SONAR_JDBC_URL=$url -d sonarqube
docker : Exception in thread “main” java.lang.IllegalArgumentException: Command-line argument must start with -D, for example -Dsonar.jdbc.username=sonar. Got: -Dsonar.
It should be at the end of the docker run command?
yeah it should be at the end of the docker run command and it works for me. are you sure that there is nothing in between? if this does not help i really think you should consider a native installation as this environment is really rare and hard to reproduce
Hi Tobias, I copied your exact command and still got that error, so seems that’s not working either. I will consider a native installation but the goal would be to run it in docker, why is this configuration so rare? It’s quite common to run docker engine on a windows server right?
Thanks anyway for your help this far!
Edit: got rid of the java error by specifying the command in capitals in the end, like -DSONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true but then it still performs the bootstrap checks and gives the error.
on windows you would either run docker for windows with wsl2 or docker machine. docker machine would allow you do ssh into the virtual machine ( docker-machine ssh default ) and change the settings there while docker for windows would allow you to make use of native features as documented in the elastic docs. plain docker engine lacks these possibilities as it is tightly mangled to hyper-v to my knowledge
this can not work as you can not pass an environment variable as a jvm argument property
Thanks, I’ll just wait till the environment variable thing works, both passing as -e (environment variable) as passing it as property at the end in the docker run command does not work back to sonarqube version 7.9 (tried all those versions). In the meantime I will look to a native installation possibility.
Edit: got it to work with the property part, had to pass it as a var, so if everyone needs this ever this was the solution for me: