使用docker-compose 编排Elasticsearch报错


大家好,我是用docker-compose 安装Elasticsearch报错了,请帮忙看看。
docker-comopose.yml
version: "3"
services:
pcsoft:
    build: ./docker-ng
    ports:
      - "8080:80"
    volumes:
      - ./www:/www/
    restart: always

db:
    image: mysql:5.7
    volumes:
      - ./dbdata:/var/lib/mysql/
    expose:
      - "33060"
    ports:
      - "33060:33060"
    environment:
      MYSQL_USER: root
      MYSQL_PASSWORD: root
      MYSQL_ROOT_PASSWORD: root
    restart: always


elasticsearch_soft:
    image: registry.cn-hangzhou.aliyuncs.com/amor/elastic:6.2.2
    container_name: elasticsearch_soft
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - ./docker-es/esdata_soft:/usr/share/elasticsearch/data
    ports:
      - 9200:9200

elasticsearch_game:
    image: registry.cn-hangzhou.aliyuncs.com/amor/elastic:6.2.2
    container_name: elasticsearch_game
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
      - "discovery.zen.ping.unicast.hosts=elasticsearch"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - ./docker-es/esdata_game:/usr/share/elasticsearch/data


报错信息

ERROR: [2] bootstrap checks failed
[1]: memory locking requested for elasticsearch process but memory is not locked
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
已邀请:

private

赞同来自:


这个问题解决了,
事情是这样的:
使用docker-compose 创建,需要保证,主机(也就是运行docker的系统)的打开文件的最大数目超过大于262144

具体情况如下:
首先查看一下:
grep vm.max_map_count /etc/sysctl.conf

如果没设置执行:
sysctl -w vm.max_map_count=262144

这个问题的答案:
https://github.com/docker-libr ... s/111

要回复问题请先登录注册