title: docker-elk - how is it persisting elasticsearch index?
body: <p>I'm just getting to grips with Docker and docker-compose, trying to create a development environment for Elasticsearch which I will deploy later.</p>
  
  <p>I've been using <a href="https://github.com/deviantony/docker-elk" rel="nofollow noreferrer">docker-elk</a> as a reference, and I've managed to create a working Elasticsearch container, seed it, and use it in my project.</p>
  
  <p>As I understand it, Docker containers don't persist data, unless you use the Volumes API and create a volume outside the container that the container then accesses (read that <a href="https://stackoverflow.com/questions/18496940#20652410">here</a>).  </p>
  
  <p>However docker-elk only uses Volumes to share a config yml file, but somehow my elastic indices are persisting when I bring the container down and up again.</p>
  
  <p>From the docker-elk readme:</p>
  
  <blockquote>
    <p>The data stored in Elasticsearch
    will be persisted after container reboot but not after container
    removal.</p>
  </blockquote>
  
  <p>Can someone please explain what part of the below configuration is allowing the docker container to persist the index?</p>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>version: '2'
  
  services:
    elasticsearch:
      build:
        context: build/elasticsearch/
      volumes:
        - ./build/elasticsearch/config.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
      ports:
        - "9200:9200"
        - "9300:9300"
      environment:
        ES_JAVA_OPTS: "-Xmx256m -Xms256m"
      networks:
        - elk
  
  networks:
    elk:
      driver: bridge
  </code></pre>
  
  <p><strong>build/elasticsearch/Dockerfile</strong></p>
  
  <pre><code>FROM docker.elastic.co/elasticsearch/elasticsearch-oss:6.0.0
  </code></pre>
  
  <p><strong>build/elasticsearch/config.yml</strong></p>
  
  <pre><code>cluster.name: "docker-cluster"
  network.host: 0.0.0.0
  discovery.zen.minimum_master_nodes: 1
  discovery.type: single-node
  </code></pre>