gpt4 book ai didi

docker - docker-compose up -d尝试在docker-compose.yml文件中设置mem_limit时给出 “OCI runtime create failed: wrong rlimit value”

转载 作者:行者123 更新时间:2023-12-02 21:18:39 24 4
gpt4 key购买 nike

docker-compose版本1.18.0,在Ubuntu 16.04上构建8dd22a9
Docker版本17.12.0-CE,内部版本c97c6d6
docker-compose文件版本:“3”

docker-compose文件的相关部分

elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
container_name: elasticsearch1
restart: unless-stopped
environment:
- http.host=0.0.0.0
- reindex.remote.whitelist=remote_es:*
- xpack.security.enabled=false
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1000000000
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200

当我执行docker-compose up -d时,出现以下错误:
ERROR: for elasticsearch1  Cannot start service elasticsearch1: OCI runtime create failed: wrong rlimit value: RLIMIT_MEM_LIMIT: unknown

有什么想法吗?

docker-compose reference document似乎暗示着,由于我未在群集模式下运行,因此即使我的docker-compose文件为版本3,我也应该对mem_limit使用版本2语法。

最佳答案

ERROR: for elasticsearch1  Cannot start service elasticsearch1: OCI runtime create failed: wrong rlimit value: RLIMIT_MEM_LIMIT: unknown


您遇到了以上错误,因为在 mem_limit部分下设置了 ulimits。它应该在与 imageenvironment等相同级别的容器级别下:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
container_name: elasticsearch1
restart: unless-stopped
environment:
- http.host=0.0.0.0
- reindex.remote.whitelist=remote_es:*
- xpack.security.enabled=false
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1000000000
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200

另一个问题在这里。根据 issue:

The v3 format is specifically designed to run with Swarm mode and the docker stack features. It wouldn't make sense for us to re-add options to that format when they have been replaced and would be ignored in Swarm mode.



这意味着您只能在版本2中使用 cpu_sharescpu_quotacpusetmem_limitmemswap_limitmem_swappiness,而只能在群体模式下在版本3中使用 new resource options

因此,如果您不想使用群体模式,则需要使用版本2。

最终的 docker-compose.yml是:
version: '2'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
container_name: elasticsearch1
restart: unless-stopped
environment:
- http.host=0.0.0.0
- reindex.remote.whitelist=remote_es:*
- xpack.security.enabled=false
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1000000000
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200

关于docker - docker-compose up -d尝试在docker-compose.yml文件中设置mem_limit时给出 “OCI runtime create failed: wrong rlimit value”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48365152/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com