Not able to access Kibana running in a Docker container on port 5601

I have built a docker image with the following Docker file.

# gunicorn-flask                                                                                                                                                                         

FROM devdb/kibana

MAINTAINER John Doe <user.name@gmail.com>

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y python python-pip python-virtualenv gunicorn

# Setup flask application
RUN mkdir -p /deploy/app

COPY gunicorn_config.py /deploy/gunicorn_config.py
COPY app /deploy/app

RUN pip install -r /deploy/app/requirements.txt

WORKDIR /deploy/app

EXPOSE 5000 5601 9200

# Start gunicorn
CMD ["/usr/bin/gunicorn", "--config", "/deploy/gunicorn_config.py", "listener:app"]

I am running the container from the image created from this Docker file as follows.

  • Bluemix Unable to connect or ping to container
  • Docker communication without using legacy links
  • Uninstall weave docker
  • Docker - Unable to locate package docker-engine
  • Docker-compose second entry in yaml using a base image generated from first entry
  • Docker - wordpress deployed on Digital Ocean Droplet - where is the wp-content?
  • sudo docker run -p 5601:5601 -p 9200:9200 -p 5000:5000 -v /home/Workspace/xits/config/elasticsearch.yml:/opt/elasticsearch/config/elasticsearch.yml -v /home/Workspace/xits/config/kibana.yml:/opt/kibana/config/kibana.yml es-kibana-gunicorn:latest
    

    The issue I am facing is that I cannot access Kibana port 5601 on my host machine. My browser page says ERR_CONNECTION_REFUSED

    I am able to access port 5000 though.

    I can’t figure out why this is.Any help would be greatly appreciated.

  • How to select file to copy based on Docker environment variable?
  • use gcsfuse to mount google cloud storage buckets in a docker container
  • Minor change in ansible playbook does not get updated in target host
  • composer install failing for unknown reason in travis-ci
  • use docker-client api to start container in Java project
  • WordPress site url issues when using local docker container
  • One Solution collect form web for “Not able to access Kibana running in a Docker container on port 5601”

    The parent Dockerfile devdb/kibana is using a script to start kibana and elasticsearch when the docker container is started. See CMD ["/sbin/my_init"] and the script itself.

    When in your own Dockerfile you use the CMD instruction, you override the one from the parents Dockerfiles.
    Since your CMD only starts gunicorn, elasticsearch and kibana won’t ever be started. That’s why there is no response on their respective network ports.

    The Docker image you inherits from inherits itself from phusion/baseimage which has its own way of making multiple processes run in Docker containers. I recommend you follow the instructions on their README file to learn how to add your gunicorn to the list of services to start. Basically you would have to define a script named run and add it to your docker image within the /etc/service/<service name>/ directory.

    In your Dockerfile, add:

    COPY run /etc/service/gunicorn/
    

    and the run script should be something similar to:

    #!/bin/bash
    cd /deploy/app
    /usr/bin/gunicorn --config /deploy/gunicorn_config.py listener:app
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.