0

I need to set up a SonarQube container on my Portainer instance. SonarQube uses Elasticsearch, which needs a kernel setting passed from the host. This issue is well documented, as mentioned in this question, but unfortunately the poster did not detail their solution.

Apparently, this issue can be fixed by running this on your host(?)

sysctl -w vm.max_map_count=262144

However, I'd like it if there were a way to specify this for this container only. Is such a thing possible, and how is it done in Portainer? I tried an environment variable, but it had no effect.

1 Answer 1

2

Containers share the machine’s OS system kernel and therefore it is not possible to change Kernel parameters like vm.max_map_count in the container itself.

The issue you linked contains a sample command

docker run -it --rm --privileged --net=host --pid=host -v /:/host debian:sid chroot /host sysctl -w vm.max_map_count=262145

how to do this when starting the container. However I wouldn't recommend doing this as the privileged mode is not safe.

I would recommend to set the vm.max_map_count on the host and pin the container to that Docker host with your cluster manager. IMHO it would also make sense to run elasticsearch and sonarqube in dedicated containers.

1
  • how would i pass it to a deployment to k8s ? is it an environment ? Nov 23, 2021 at 12:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .