Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing ulimit value in docker run command

I tried to install this image...

# docker run -d -p 5601:5601 -p 5000:5000  -p 9200:9200 --ulimit 65536  kenwdelong/elk-docker:latest

and got this error:

invalid argument "65536" for --ulimit: invalid ulimit argument: 65536
See 'docker run --help'.

If I remove ulimit option, then I get the following error in the container log.

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

As per google, docker-compose.yml file can have ulimit clause like this...

version: '2'
services:
  elastic:
      image: elasticsearch
      environment:
          - ES_JAVA_OPTS=-Xmx2g -Xms2g
      ulimits:
          nofile:
              soft: 65536
              hard: 65536

I do not want to use docker-compose, but need that functionality in run command.

like image 757
shantanuo Avatar asked Sep 13 '25 18:09

shantanuo


1 Answers

Use the form: docker run --ulimit <type>=<soft>:<hard>

So, for your nofile, an example would be --ulimit nofile=65536:65536

Docs:

https://docs.docker.com/engine/reference/commandline/run/#set-ulimits-in-container-ulimit

like image 54
Robert Avatar answered Sep 16 '25 07:09

Robert