<p><a href="https://github.com/elastic/stack-docker/blob/master/docker-compose.yml" rel="nofollow noreferrer">https://github.com/elastic/stack-docker/blob/master/docker-compose.yml</a></p>

<p>This is an official docker-compose for running Elasticsearch, and will make a good starting point for whatever you're trying to achieve. This would be the key part:</p>

<pre><code>  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}
    environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1', 'ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
    ports: ['127.0.0.1:9200:9200']
    networks: ['stack']
</code></pre>

<p>But I'd recommend cloning the entire repository locally and running <code>docker-compose up</code> to experiment.</p>

CC BY-SA 3.0
2017-10-03T10:35:54.627Z
2017-10-03T10:35:54.627Z
user2640621
<p>All of the tutorials online say to manually start elasticsearch as a daemon with a docker command from the command line. Is there a way to auto run it like redis, postgres and other services do from the docker compose yaml file?</p>

CC BY-SA 3.0
2017-07-26T07:29:20.610Z
I found a script in bin/docker-start.sh that I added some code to. I am still experimenting with it.
Natus Drew
CC BY-SA 3.0
2017-08-02T01:52:58.650Z
you can easily use the example from https://hub.docker.com/_/elasticsearch/ to run the elasticsearch using docker compose
Wissam Roujoulah
<docker><docker-compose><elastic>
Autorun ElasticSearch with Docker Compose
Natus Drew
# Autorun ElasticSearch with Docker Compose

(Asked by: username_0 on 2017-07-25)

All of the tutorials online say to manually start elasticsearch as a daemon with a docker command from the command line. Is there a way to auto run it like redis, postgres and other services do from the docker compose yaml file?

**Tags:** docker, docker-compose, elastic

> **Comments:**
> **username_0**: I found a script in bin/docker-start.sh that I added some code to. I am still experimenting with it.  
> **username_1**: you can easily use the example from https://hub.docker.com/_/elasticsearch/ to run the elasticsearch using docker compose  

---

## 1 answers

### Answer by username_2 on 2017-10-03. Score: 1

https://github.com/elastic/stack-docker/blob/master/docker-compose.yml
This is an official docker-compose for running Elasticsearch, and will make a good starting point for whatever you're trying to achieve. This would be the key part:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}
    environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1', 'ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
    ports: ['127.0.0.1:9200:9200']
    networks: ['stack']

But I'd recommend cloning the entire repository locally and running docker-compose up to experiment.


---

