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.

  • CentOS 7 : docker in docker: “Error: No space left on device”
  • Docker error: HTTP 408 response body: invalid character '<' looking for beginning of value
  • renaming docker0 virtual bridge name to something else
  • Using nginx to reverse proxy to Docker services
  • Pulling docker images
  • Cached Docker image?
  • 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.

  • Docker, pylibmc, memcached
  • Ubuntu: Cronjob for renew cerbot certificates
  • How to use Docker in sbt-native-packager 0.8.0-M2 with Play
  • how to list Docker images with Vagrant and Kubernetes
  • How to setup hostnames using docker-compose?
  • How do I make a comment in a Dockerfile?
  • 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.