title: Elasticsearch and kibana docker images are not working properly
body: <p>I followed the accepted answer here <a href="https://stackoverflow.com/questions/44002643/how-to-use-the-official-docker-elasticsearch-container">How to use the official docker elasticsearch container?</a> </p>
  
  <p>but the <strong>kibana UI is not coming up in the browser localhost:5601</strong>, <strong>what could be the problem?</strong> </p>
  
  <pre><code> [root@localhost ~]# sysctl -w vm.max_map_count=262144
      vm.max_map_count = 262144
  
   [root@localhost ~]# cat /proc/sys/vm/max_map_count
   262144
   [root@localhost ~]#
  </code></pre>
  
  <p><strong>error log: docker-compose up</strong></p>
  
  <pre><code>kibana       | {"type":"log","@timestamp":"2020-05-28T02:09:53Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"}
  kibana      | {"type":"log","@timestamp":"2020-05-28T02:09:55Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"}
  kibana      | {"type":"log","@timestamp":"2020-05-28T02:09:55Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}
  </code></pre>
  
  <p><strong>docker ps :</strong></p>
  
  <pre><code>[root@localhost ~]# docker ps
  CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS              PORTS                                            NAMES
  b978841f86d5        docker.elastic.co/elasticsearch/elasticsearch:6.6.1   "/bin/bash bin/es-do…"   14 minutes ago      Up 31 seconds       0.0.0.0:9200-&gt;9200/tcp, 0.0.0.0:9300-&gt;9300/tcp   elasticsearch
  9f255a223659        docker.elastic.co/kibana/kibana:6.6.1                "/bin/sh -c /usr/loc…"   14 minutes ago      Up 31 seconds       0.0.0.0:5601-&gt;5601/tcp                           kibana
  c21d1a77f25f        mobz/elasticsearch-head:5                             "/bin/sh -c 'grunt s…"   14 minutes ago      Up 31 seconds       0.0.0.0:9100-&gt;9100/tcp                           head  
  </code></pre>
  
  <p><strong>OS: Centos 7</strong></p>
  
  <p><strong>docker: latest</strong></p>
  
  <p><strong>docker-compose: latest</strong></p>
  
  <p>docker-compose.yml </p>
  
  <pre><code>    version: '3'
  services:
    elasticsearch:
      image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
      container_name: elasticsearch
      environment:
        - node.name=es01
        - cluster.name=docker-cluster
        - bootstrap.memory_lock=true
        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      ulimits:
        nproc: 65535
        memlock:
          soft: -1
          hard: -1
      cap_add:
        - ALL
      privileged: true
      ports:
        - 9200:9200
        - 9300:9300
      networks:
        - elastic
  
    kibana:
      image: docker.elastic.co/kibana/kibana-oss:6.6.1
      container_name: kibana
      environment:
        SERVER_NAME: localhost
        ELASTICSEARCH_URL: http://elasticsearch:9200
      depends_on:
        - elasticsearch 
      ports:
        - 5601:5601
      ulimits:
        nproc: 65535
        memlock:
          soft: -1
          hard: -1
      cap_add:
        - ALL
      networks:
        - elastic
  
  network:
    elastic:
      driver: bridge
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ieaE3.png" rel="nofollow noreferrer">final capture here after adding the network part (suggested by @Nagle Zhang </a></p>
  
  <p><a href="https://i.stack.imgur.com/yu52O.png" rel="nofollow noreferrer">On GCP ubuntu 16.04 </a></p>