# Unable to run elastic stack on docker

**URL:** https://discuss.elastic.co/t/unable-to-run-elastic-stack-on-docker/219144
**Category:** Elasticsearch
**Tags:** docker
**Created:** [February 13, 2020, 7:44am UTC](https://discuss.elastic.co/t/unable-to-run-elastic-stack-on-docker/219144 "2020-02-13T07:44:09Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![y0y0z](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@y0y0z](https://discuss.elastic.co/u/y0y0z)
#### Post date: [February 13, 2020, 7:44am UTC](https://discuss.elastic.co/t/unable-to-run-elastic-stack-on-docker/219144/1 "2020-02-13T07:44:10Z")

</div>

i create a specification for the stack using docker-compose:

```
# docker-compose.yml
version: '3.7'
services:
  elasticsearch:
    container_name: elasticsearch
    image: elasticsearch:7.6.0
    ports:
      - "9200:9200"
    environment:
      discovery.type: single-node

  kibana:
    container_name: kibana
    image: kibana:7.6.0
    ports:
      - "5601:5601"
    depends_on:
      - elasticsearch
    environment:
      ELASTICSEARCH_HOSTS: http://elasticsearch:9200

```

then, i spin up the containers

```
$ docker-compose up -d
Creating network "tmp_default" with the default driver
Creating elasticsearch ... done
Creating kibana ... done

```

checking the health of the elasticsearch from my host operating system:

```
$ curl -s 'localhost:9200/_cluster/health?wait_for_status=yellow&timeout=50s' | jq
{
  "cluster_name": "docker-cluster",
  "status": "green",
  "timed_out": false,
  "number_of_nodes": 1,
  "number_of_data_nodes": 1,
  "active_primary_shards": 3,
  "active_shards": 3,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 0,
  "delayed_unassigned_shards": 0,
  "number_of_pending_tasks": 0,
  "number_of_in_flight_fetch": 0,
  "task_max_waiting_in_queue_millis": 0,
  "active_shards_percent_as_number": 100
}

```

verifying that elasticsearch is reachable from kibana container:

```
$ docker-compose exec -u root kibana curl -s 'elasticsearch:9200/_cluster/health?wait_for_status=yellow&timeout=50s' | jq
{
  "cluster_name": "docker-cluster",
  "status": "green",
  "timed_out": false,
  "number_of_nodes": 1,
  "number_of_data_nodes": 1,
  "active_primary_shards": 3,
  "active_shards": 3,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 0,
  "delayed_unassigned_shards": 0,
  "number_of_pending_tasks": 0,
  "number_of_in_flight_fetch": 0,
  "task_max_waiting_in_queue_millis": 0,
  "active_shards_percent_as_number": 100
}

```

verifying that the environment variables in the docker-compose file took precedence over the kibana.yml configuration file:

```
$ docker-compose exec kibana ps -efww | grep node
kibana 6 1 4 22:08 ? 00:00:57 /usr/share/kibana/bin/../node/bin/node /usr/share/kibana/bin/../src/cli --cpu.cgroup.path.override=/ --cpuacct.cgroup.path.override=/ --elasticsearch.hosts=http://elasticsearch:9200

```

verifying that kibana is reachable from elasticsearch container:

```
$ docker-compose exec elasticsearch ping kibana -c 1
PING kibana (192.168.224.3) 56(84) bytes of data.
64 bytes from kibana.tmp_default (192.168.224.3): icmp_seq=1 ttl=64 time=0.342 ms

--- kibana ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.342/0.342/0.342/0.000 ms

```

double verify that the elasticsearch and kibana are on the same network:

```
$ docker network inspect tmp_default --format '{{json .}}' | jq '.Containers'
{
  "c4378048f314429d47fe145ec426d992fb19b0843a205d35cd99be96b0202946": {
    "Name": "elasticsearch",
    "EndpointID": "67631e0128bae3e2f7c3aae7bb504672e685678c9f259ddd73d652b654790e24",
    "MacAddress": "02:42:c0:a8:e0:02",
    "IPv4Address": "192.168.224.2/20",
    "IPv6Address": ""
  },
  "ea5d77068a1c0c26d30cb5268ed94be6bbb0c50332e104245d49a56c0e45d78f": {
    "Name": "kibana",
    "EndpointID": "d444344d5d8fef2f5e67dd74ec9c97a1b49b3bc80f1c6b117bcf8ceb6bbcf952",
    "MacAddress": "02:42:c0:a8:e0:03",
    "IPv4Address": "192.168.224.3/20",
    "IPv6Address": ""
  }
}

```

navigating to [kibana management](http://localhost:5601/app/kibana#/management/elasticsearch/remote_clusters/list?_g=()), there is no indication for tje connection to elasticsearch cluster that was specified in the `docker-compose.yml`.

wen adding an elasticsearch remote cluster manually, by typing `elasticsearch:9200` in the seed nodes field, then click save - it fails, but succeeds for `elasticsearch:9300`. **why?**

replacing in `docker-compose.yml` the line `ELASTICSEARCH_HOSTS: http://elasticsearch:9200` with `ELASTICSEARCH_HOSTS: http://elasticsearch:9300` and repeat everything, didn't resolve the issue.

i even tried [another `docker-compose.yml` file](https://discuss.elastic.co/t/linking-kibana-and-elasticsearch-with-docker-compose/179040/4), but got the same behavior. would appreciate if you could assist me making the elastic stack working.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [February 13, 2020, 8:06am UTC](https://discuss.elastic.co/t/unable-to-run-elastic-stack-on-docker/219144/2 "2020-02-13T08:06:29Z")

</div>

quick guess from reading your docker setup: By default elasticsearch only listens on localhost, so it is not exposed to the outside.

try

```auto
 environment:
      - http.host=0.0.0.0

```

for the elasticsearch service to make sure that the HTTP service is exposed to the outside.

---

<div class="post-metadata">

### Author: ![y0y0z](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@y0y0z](https://discuss.elastic.co/u/y0y0z)
#### Post date: [February 13, 2020, 8:08am UTC](https://discuss.elastic.co/t/unable-to-run-elastic-stack-on-docker/219144/3 "2020-02-13T08:08:33Z")

</div>

@spinscale: yet, elasticsearch is accessible from kibana. please see above. anyhow, gonna try your offering and will report back in a few.

---

<div class="post-metadata">

### Author: ![y0y0z](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@y0y0z](https://discuss.elastic.co/u/y0y0z)
#### Post date: [February 13, 2020, 8:16am UTC](https://discuss.elastic.co/t/unable-to-run-elastic-stack-on-docker/219144/4 "2020-02-13T08:16:47Z")

</div>

@spinscale: your offer did not change anything.

also, wanted to verify your claim. so using the `docker-compose.yml` i posted, i started the elasticsearch and then:

```
$ docker-compose exec elasticsearch /bin/bash -c 'yum update -q && yum install net-tools -y -q && netstat -nlupt'
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.11:34719 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:9200 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:9300 0.0.0.0:* LISTEN -
udp 0 0 127.0.0.11:42996 0.0.0.0:* - 

```

as you can see, elasticsearch do listen to 0.0.0.0

---

<div class="post-metadata">

### Author: ![y0y0z](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@y0y0z](https://discuss.elastic.co/u/y0y0z)
#### Post date: [February 13, 2020, 9:08am UTC](https://discuss.elastic.co/t/unable-to-run-elastic-stack-on-docker/219144/5 "2020-02-13T09:08:58Z")

</div>

after debugging using the command line, i can see kibana indecies on elasticsearch but see no indication for the elasticsearch connection on kibana's gui.

feels like a gui bug.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 12, 2020, 9:09am UTC](https://discuss.elastic.co/t/unable-to-run-elastic-stack-on-docker/219144/6 "2020-03-12T09:09:11Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
