I am using the following compose file. My objective is to create the kibana dashboard automatically when the docker container starts hence I created customize image for kibana.
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
container_name: elasticsearch
environment:
- "discovery.type=single-node"
- "xpack.security.enabled=false"
- "xpack.monitoring.enabled=false"
volumes:
- esdata:/usr/share/elasticsearch/data:rw
ports:
- 9200:9200
networks:
- elk
restart: unless-stopped
kibana:
depends_on:
- elasticsearch
#image: docker.elastic.co/kibana/kibana:6.2.4
image: ervikrant06/kibana:6.2.4.v1
environment:
- "xpack.monitoring.enabled=false"
networks:
- elk
ports:
- 5601:5601
restart: unless-stopped
command: sh bp-dashboard.sh
logstash:
image: ervikrant06:logstashv3
#image: docker.elastic.co/logstash/logstash:6.2.4
depends_on:
- elasticsearch
networks:
- elk
environment:
- "xpack.security.enabled=false"
- "INPUT1=/var/tmp/log"
- "xpack.monitoring.enabled=false"
restart: unless-stopped
#volumes:
#- /tmp/logstash/:/var/tmp/log
#- /root/elk-logparser/pipeline/:/usr/share/logstash/pipeline/
volumes:
esdata:
driver: local
networks:
elk:
Following is the dockerfile used to create kibana image:
# cat kibana/Dockerfile
FROM docker.elastic.co/kibana/kibana:6.2.4
ADD . /usr/share/kibana
content of the script which is used to issue curl POST command.
# cat bp-dashboard.sh
#!/bin/bash
sleep 30
curl -XPOST kibana:5601/api/kibana/dashboards/import -H 'kbn-xsrf:true' -H 'Content-type:application/json' -d @/usr/share/kibana/bp-dashboard.json
I have already verified that after running the container using docker run command I am able to run the script inside the container without any issue.
This is what i have seen on the screen after running docker-compose up.
kibana_1 | % Total % Received % Xferd Average Speed Time Time Time Current
kibana_1 | Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed connect to kibana:5601; Connection refused
kibana_1 | % Total % Received % Xferd Average Speed Time Time Time Current
kibana_1 | Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed connect to kibana:5601; Connection refused
kibana_1 | % Total % Received % Xferd Average Speed Time Time Time Current
kibana_1 | Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed connect to kibana:5601; Connection refused
Anyone can please help me to point what I am doing wrong here?