Docker Community Forums

Share and learn in the Docker community.

Ulimits not set with docker deploy in swarm mode


(Dejongm) #1

Hello,
When setting ulimit memlock and deploying in swarm mode, the ulimits are not applied to the target containers. I’m running docker version 1.13 with native swarm mode built in. Below is my my compose.yml:

version: '3’
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.4.1
environment:
- cluster.name=elastic-cluster
- ES_JAVA_OPTS=-Xms2048m -Xmx2048m
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/elasticsearch/usr/share/elasticsearch/data:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic-net
deploy:
placement:
constraints:
- node.hostname==centos-atomic01.localdomain

Docker inspect of the container shows Ulimits set to null.

“OomKillDisable”: false,
“PidsLimit”: 0,
“Ulimits”: null,
“CpuCount”: 0,
“CpuPercent”: 0,

Any help would be appreciated.

Thanks!


(Jacob Magnusson) #2

I’m experiencing this as well. Ulimits is null and elasticsearch complains: memory locking requested for elasticsearch process but memory is not locked.

I think the reason for this is simply that swarm mode deployments don’t pass --ulimit options at the moment.


(Abhishekgaloda) #3

Could something like this be helpful by using environment variable and setting memory limits

elasticsearch:
image: elasticsearch
ports:
- "9200:9200"
networks:
- net
environment:
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
logging:
driver: "json-file"
options:
max-size: 10M
max-file: 1
deploy:
mode: replicated
replicas: 1
resources:
limits:
memory: 1000M
volumes:
- ./esdata:/usr/share/elasticsearch/data

More details can be found in this example


(Tylerjharden) #4

I am being plauged by the same issue with elasticsearch:6.0.0-oss inside Docker EE when creating a stack from within the UCP.

The memlock is configured correctly according to all documentation I’ve read, not sure why this is happening.


(Ladislav Gazo) #5

Hi Tyler,

have you been able to resolve it? I played with various parameters but without success…