# Connection Refused Docker Kibana

**URL:** https://discuss.elastic.co/t/connection-refused-docker-kibana/100945
**Category:** Kibana
**Created:** [September 18, 2017, 11:45pm UTC](https://discuss.elastic.co/t/connection-refused-docker-kibana/100945 "2017-09-18T23:45:20Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![scottf](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@scottf](https://discuss.elastic.co/u/scottf)
#### Post date: [September 18, 2017, 11:45pm UTC](https://discuss.elastic.co/t/connection-refused-docker-kibana/100945/1 "2017-09-18T23:45:20Z")

</div>

Kibana connection refused,  
(1) Plain vanilla linux ubuntu 17. Docker 1.12.6 (I've got similar behavior on centos 7 / docker 17)

(2.1) using docker elasticsearch 5.6.1. This command to start es

```auto
sudo docker run -d -p 9200:9200 -p 9300:9300 \
    -e "discovery.type=single-node" \
    docker.elastic.co/elasticsearch/elasticsearch:5.6.1

```

(2.2) can `curl -v -u elastic:changeme localhost:9200`  
(2.3) can `curl -v -u elastic:changeme 192.168.43.93:9200`

(3) This is my kibana.yml

```auto
server.host: 192.168.43.93
server.name: scotts-kibana
elasticsearch.url: http://192.168.43.93:9200
elasticsearch.username: elastic
elasticsearch.password: changeme
xpack.monitoring.ui.container.elasticsearch.enabled: false
xpack.monitoring.enabled: false

```

(4.1) using docker kibana 5.6.1 This command to start kibana bash

```auto
sudo docker run -it -p 5601:5601 \
    -v /home/scott/kibana.yml:/usr/share/kibana/config/kibana.yml \
    docker.elastic.co/kibana/kibana:5.6.1 \
    bash

```

(4.2) can `curl -v -u elastic:changeme 192.168.43.93:9200`  
(4.3) kill that docker container

(5.1) using docker kibana 5.6.1 This command to start kibana

```auto
sudo docker run -it -p 5601:5601 \
    -v /home/scott/kibana.yml:/usr/share/kibana/config/kibana.yml \
    docker.elastic.co/kibana/kibana:5.6.1

```

(5.2) Fails `curl -u elastic:changeme 192.168.43.93:5601`

```auto
Failed to connect to 192.168.43.93 port 5601: Connection refused

```

---

<div class="post-metadata">

### Author: ![mujtabahussain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mujtabahussain/32/17514_2.png) [@mujtabahussain](https://discuss.elastic.co/u/mujtabahussain)
#### Post date: [September 19, 2017, 1:42am UTC](https://discuss.elastic.co/t/connection-refused-docker-kibana/100945/2 "2017-09-19T01:42:07Z")

</div>

Inside each container, what does `sudo netstat -nltp` tell you? Are the ports you expect to be up up?

---

<div class="post-metadata">

### Author: ![scottf](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@scottf](https://discuss.elastic.co/u/scottf)
#### Post date: [September 19, 2017, 1:47am UTC](https://discuss.elastic.co/t/connection-refused-docker-kibana/100945/3 "2017-09-19T01:47:17Z")

</div>

I'm starting to think it is related to the xpack security. If I enable it by commenting out the two xpack settings that enabled: false, the root curl still refuses which was the misdirection (didn't curl -v) but it shows a redirect to /login.

---

<div class="post-metadata">

### Author: ![mujtabahussain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mujtabahussain/32/17514_2.png) [@mujtabahussain](https://discuss.elastic.co/u/mujtabahussain)
#### Post date: [September 19, 2017, 3:32am UTC](https://discuss.elastic.co/t/connection-refused-docker-kibana/100945/4 "2017-09-19T03:32:52Z")

</div>

> [@scottf](#):
>
> I'm starting to think it is related to the xpack security. If I enable it by commenting out the two xpack settings that enabled: false, the root curl still refuses which was the misdirection (didn't curl -v) but it shows a redirect to /login.

That's very weird. If possible, definitely log it with GitHub issues.

---

<div class="post-metadata">

### Author: ![scottf](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@scottf](https://discuss.elastic.co/u/scottf)
#### Post date: [September 19, 2017, 5:46am UTC](https://discuss.elastic.co/t/connection-refused-docker-kibana/100945/5 "2017-09-19T05:46:05Z")

</div>

So I'm moving away from the xpack idea. It's enabled (all default settings) but I still have the network looking issue.

`sudo netstat -nltp` doesn't work for me, I tried it inside `docker exec -it kibana bash`

```auto
bash-4.2$ netstat
bash: netstat: command not found

```

Regardless, when I am inside the container I can successfully `curl localhost:5601/app/kibana`

It's outside the container that isn't working. I don't know where the problem lies (obviously), is it in the kibana image? Is it Docker? Is it my networking configuration of the box. I mean the same exact box works for elasticsearch. Different port though, but `-p 9200:5601` for example didn't work either.

It does behave differently based on how I start up the container. if I do `-p 5601:5601` neither of these curls work:

```auto
curl localhost:5601
curl 127.0.0.1:5601

```

but if I do --network=host both curls work.

Again, same box does one thing with es another with kibana. Docker is the same in both cases, this leads me to look at the image. I know for elasticsearch, I had to configure the bind and publish hosts. Can you do this for Kibana? It didn't complain but it didn't help.

```auto
network.bind_host: 0.0.0.0
network.publish_host: 123.45.67.88

```

My gut tells me it's something with the image and the way it is configured, but I can't prove that. Again, docker and the box/os are the same in es / kibana

---

<div class="post-metadata">

### Author: ![scottf](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@scottf](https://discuss.elastic.co/u/scottf)
#### Post date: [September 19, 2017, 6:33pm UTC](https://discuss.elastic.co/t/connection-refused-docker-kibana/100945/6 "2017-09-19T18:33:59Z")

</div>

I've run both ElasticSearch and Kibana 5.6.1 images on the same exact aws instance, at the same time, running

- CentOS Linux release 7.3.1611 (Core)
- Docker version 17.06.1-ce, build 874a737
- It has an ip setup by a network interface (eni, 10.207.67.250)
- It has a Route53 asscoiated with that eni ([kibana.mycompany.com](http://kibana.mycompany.com))

Also I've also run both on Ubuntu 17.04. It doesn't have the route53, but it has localhost, 127 and an ip. It succeeds and fails identically to the centos setup

- Ubuntu 17.04
- Docker version 1.12.6, build 78d1802

```auto
Legend:
  * worked
  x failed

```

#### ElasticSearch with container networking and port mapping

I can get to the service in all cases.

```auto
docker run -d \
    -p 9200:9200 -p 9300:9300 \
    -e "discovery.type=single-node" \
    docker.elastic.co/elasticsearch/elasticsearch:5.6.1 

* curl -v -u elastic:changeme localhost:9200/_cat/health
* curl -v -u elastic:changeme 127.0.0.1:9200/_cat/health
* curl -v -u elastic:changeme 10.207.67.250:9200/_cat/health
* curl -v -u elastic:changeme kibana.mycompany.com:9200/_cat/health

```

#### ElasticSearch with host networking

I can get to the service in all cases.

```auto
docker run -d \
    --network=host \
    -e "discovery.type=single-node" \
    docker.elastic.co/elasticsearch/elasticsearch:5.6.1

* curl -v -u elastic:changeme localhost:9200/_cat/health
* curl -v -u elastic:changeme 127.0.0.1:9200/_cat/health
* curl -v -u elastic:changeme 10.207.67.250:9200/_cat/health
* curl -v -u elastic:changeme kibana.mycompany.com:9200/_cat/health

```

#### Kibana.yml

```auto
server.name: kibana-node-1
elasticsearch.url: http://kibana.mycompany.com:9200
elasticsearch.username: elastic
elasticsearch.password: changeme
xpack.monitoring.ui.container.elasticsearch.enabled: true

```

#### Kibana with container networking and port mapping

I cannot get to the service at all.

```auto
docker run -d \
    -p 5601:5601 
    -v /home/centos/kibana.yml:/usr/share/kibana/config/kibana.yml \
    docker.elastic.co/kibana/kibana:5.6.1

x curl -v localhost:5601/app/kibana
x curl -v 127.0.0.1:5601/app/kibana
x curl -v 10.207.67.250:5601/app/kibana
x curl -v kibana.mycompany.com:5601/app/kibana

```

#### Kibana with host networking

I can get to the service locally.

```auto
docker run -d \
    --network=host \
    -v /home/centos/kibana.yml:/usr/share/kibana/config/kibana.yml \
    docker.elastic.co/kibana/kibana:5.6.1
    
* curl -v localhost:5601/app/kibana
* curl -v 127.0.0.1:5601/app/kibana
x curl -v 10.207.67.250:5601/app/kibana
x curl -v kibana.mycompany.com:5601/app/kibana

```

---

<div class="post-metadata">

### Author: ![scottf](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@scottf](https://discuss.elastic.co/u/scottf)
#### Post date: [September 20, 2017, 11:30pm UTC](https://discuss.elastic.co/t/connection-refused-docker-kibana/100945/7 "2017-09-20T23:30:07Z")

</div>

what do these configuration settings do (from [https://www.elastic.co/guide/en/kibana/current/settings.html](https://www.elastic.co/guide/en/kibana/current/settings.html))

```auto
server.host
elasticsearch.preserveHost

```

Since this is running in a docker container, does the default server.host of "localhost" cause problems? Should this maybe be set to the ip address of the host machine?

For my actual elasticsearch nodes, I had set these up in elasticsearch.yml. Is the server.host the equivalent? Just trying to work through this.

```auto
network.bind_host: 0.0.0.0
network.publish_host: 10.207.67.250

```

---

<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: [October 18, 2017, 11:30pm UTC](https://discuss.elastic.co/t/connection-refused-docker-kibana/100945/8 "2017-10-18T23:30:20Z")

</div>

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