Cannot reach kibana in docker

Hi,

I assume it is some stupid little error, but I cannot reach my kibana running in a docker container. (i am quite new to docker, but I like it so far :wink: )

I took following image: docker.elastic.co/kibana/kibana:6.2.3

docker ps shows me the following:

CONTAINER ID        IMAGE                                       COMMAND                  CREATED             STATUS              PORTS                     NAMES
fb97e3925da3        docker.elastic.co/kibana/kibana:6.2.3       "/bin/bash /usr/loca…"   About an hour ago   Up 21 minutes       0.0.0.0:15601->5601/tcp   kibana
e087cf628a3a        docker.elastic.co/logstash/logstash:6.2.3   "/usr/local/bin/dock…"   About an hour ago   Up About an hour    5044/tcp, 9600/tcp        logstash_ingest_1
cf3f150d5e1d        redis                                       "docker-entrypoint.s…"   8 days ago          Up 6 days           0.0.0.0:6379->6379/tcp    redis

Inside the docker container it seems fine:

bash-4.2$ curl localhost:5601
<script>var hashRoute = '/kibana-TSI/app/kibana';
var defaultRoute = '/kibana-TSI/app/kibana';

var hash = window.location.hash;
if (hash.length) {
  window.location = hashRoute + hash;
} else {
  window.location = defaultRoute;
}</script>bash-4.2$

When I want to connect from the host this happens:

[root@server ~]$ curl localhost:15601
curl: (56) Recv failure: Connection reset by peer
[root@server ~]$ curl xxx.xxx.xxx.xxx:15601
curl: (7) Failed connect to xxx.xxx.xxx.xxx:15601; Connection refused

I am creating the container with following script:

 cat docker_kibana.sh
#!/bin/bash
HOST_PORT=15601
KIBANA_ELASTICSEARCH_URL=http://139.1.117.41:19200
CPU_LIMIT=1.0
CONFIG_HOST=/usr/local/elastic/docker/kibana/config
CONFIG_DOCKER=/usr/share/kibana/config
#IMAGE=blacktop/kibana:6.2.3-xp
IMAGE=docker.elastic.co/kibana/kibana:6.2.3

sudo docker run \
-d \
--cpus=$CPU_LIMIT \
--init \
-v $CONFIG_HOST:$CONFIG_DOCKER \
--name kibana \
--hostname kibana \
-e KIBANA_ELASTICSEARCH_URL=$KIBANA_ELASTICSEARCH_URL \
-p 0.0.0.0:$HOST_PORT:5601 \
$IMAGE

my effective kibana.yml wihtout comments looks like that:

server.port: 5601
server.basePath: "/kibana-TSI"
elasticsearch.url: "http://xxx.xxx.xxx.xxx:19200"
elasticsearch.requestTimeout: 60000
xpack.security.enabled: false

Any help is appreciated.
Thanks in Advance, Andreas

Am not too sure of the docker config. Let me ping my colleague @jarpy who might shed more light on this when he has some time.

Thanks
Rashmi

Hi,

You'll want to set server.host in your kibana.yml. If you don't, Kibana will default to only binding to localhost. The important part to that is that the container is its own "localhost", so the default value will only allow Kibana to be seen from inside the container, which is clearly not what you want.

That's why, in the default config, we set server.host to 0 (shortcut for 0.0.0.0).

1 Like

oh great. Thanks, now it works like charme.

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