LoginSignup
2
1

More than 5 years have passed since last update.

DockerにElasticsearchを

Posted at

[root@Dockh ~]# docker pull docker.elastic.co/elasticsearch/elasticsearch:5.3.0
Trying to pull repository docker.elastic.co/elasticsearch/elasticsearch ...
5.3.0: Pulling from docker.elastic.co/elasticsearch/elasticsearch
3690ec4760f9: Pull complete
f52154c3d3fc: Pull complete
4075cc5db14a: Pull complete
2d52f619a2d6: Pull complete
8bb7b04253b3: Pull complete
1cb5a2a95e15: Pull complete
e2f60cff0f2f: Pull complete
9eb2cf345f74: Pull complete
ff68f5fa0401: Pull complete
90f6e7841041: Pull complete
Digest: Digest: sha256:56ac964338bc74f3874d63271433f6555648d55405a89c96f56a18dee48456eb
[root@Dockh ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.elastic.co/elasticsearch/elasticsearch 5.3.0 ccec59a7dd84 3 weeks ago 206.4 MB
[root@Dockh ~]#

docker-compose.yml

[root@Dockh ~]# cat docker-compose.yml
version: '2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.3.0
    container_name: elasticsearch
    environment:
      - cluster.name=dev-kibana-cluster
      - node.name=dev-kibana-01
      - bootstrap.memory_lock=true
      - xpack.security.enabled=false
      - xpack.monitoring.enabled=true
      - xpack.watcher.enabled=false
      - xpack.graph.enabled=false
      - xpack.monitoring.history.duration=1d
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    mem_limit: 2g
    memswap_limit: 2g
    cap_add:
      - IPC_LOCK
    volumes:
      - es_data1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - kibana_net
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "10"
  kibana:
    image: docker.elastic.co/kibana/kibana:5.3.0
    container_name: kibana
    environment:
      ELASTICSEARCH_URL: "http://elasticsearch:9200"
      XPACK_MONITORING_ELASTICSEARCH_URL: "http://elasticsearch:9200"
      XPACK_SECURITY_ENABLED: "false"
    ports:
     - 80:5601
    networks:
      - kibana_net
    mem_limit: 2g
    memswap_limit: 2g
    depends_on:
      - elasticsearch
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "10"

volumes:
  es_data1:
    driver: local

networks:
  kibana_net:
    driver: bridge
[root@Dockh ~]# docker-compose up -d
Starting elasticsearch
Starting kibana
[root@Dockh ~]# docker-compose ps
    Name                   Command               State                Ports               
-----------------------------------------------------------------------------------------
elasticsearch   /bin/bash bin/es-docker          Up      0.0.0.0:9200->9200/tcp, 9300/tcp 
kibana          /bin/sh -c /usr/local/bin/ ...   Up      0.0.0.0:80->5601/tcp             
[root@Dockh ~]# 
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1