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


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 /deploy/
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/", "listener:app"]

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

  • Moving from Docker Containers to Cloud Foundry containers
  • How to select volume mountpoint in docker-compose.yml?
  • Download docker logs from remote server
  • Docker for Microservice app
  • Block outgoing connections to private IPs from Docker containers
  • Pull image from another Docker Machine
  • 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 set the workdir of a container launched by Kubernetes
  • Why do Docker official images not use USER as required by “best practices”
  • docker cp permissions are wrong when you mount the directory back into container
  • How is Docker light weight
  • Docker container calls binary from another container
  • What are the different ways of implementing Docker FROM?
  • 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:

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