Docker Community Forums

Share and learn in the Docker community.

Container port not reachable from host

docker

(0asp0) #1

Hi, i am new to docker, but it looks interesting to me.

I am trying to run kibana in a docker container. Port availability inside the container works, but not from host.

I am using this script to build the container:

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

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 container it looks good, the application’s port is reachable via curl on localhost:5601

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

Any help is appreciated.
Thanks in advance, Andreas


(Willa) #2

@0asp0 did you find the reason for this problem?