Help us understand the problem. What is going on with this article?

Docker + Elasticsearch + Kibana

More than 3 years have passed since last update.


  • DockerでElasticsearchとKibana


  • OS X 10.9.5
  • DockerToolbox-1.9.1f
    • docker-machine 0.5.4
    • docker 1.9.1


$ docker-machine create --driver virtualbox dev
Creating CA: /Users/moriyasu/.docker/machine/certs/ca.pem
Creating client certificate: /Users/moriyasu/.docker/machine/certs/cert.pem
Running pre-create checks...
Creating machine...
(dev) Creating VirtualBox VM...
(dev) Creating SSH key...
(dev) Starting VM...
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available...
Detecting operating system of created instance...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect Docker to this machine, run: docker-machine env dev


$ docker-machine ls
NAME   ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER   ERRORS
dev    -        virtualbox   Running   tcp://           v1.9.1


$ docker-machine env dev
export DOCKER_HOST="tcp://"
export DOCKER_CERT_PATH="/Users/moriyasu0410/.docker/machine/machines/dev"
# Run this command to configure your shell:
# eval "$(docker-machine env dev)"


$ export DOCKER_TLS_VERIFY="1"
$ export DOCKER_HOST="tcp://"
$ export DOCKER_CERT_PATH="/Users/moriyasu0410/.docker/machine/machines/dev"
$ export DOCKER_MACHINE_NAME="dev"

Elasticsearch Dockerfile作成

$ cd
$ mkdir -p docker/es
$ cd docker/es
$ vim Dockerfile
FROM centos:6.6

RUN yum -y update

RUN yum install -y wget tar

RUN yum install -y java-1.8.0-openjdk
ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk.x86_64
ENV CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

ENV ES_PKG_NAME elasticsearch-1.7.4
RUN cd /
RUN wget$ES_PKG_NAME.tar.gz
RUN tar xvzf $ES_PKG_NAME.tar.gz
RUN rm -f $ES_PKG_NAME.tar.gz
RUN mv /$ES_PKG_NAME /elasticsearch

CMD ["/elasticsearch/bin/elasticsearch"]

EXPOSE 9200 9300


$ docker build --no-cache=true -t centos6/es .


$ docker run --name es -t -i -d -p 9200:9200 -p 9300:9300 centos6/es

kibana Dockerfile

$ cd
$ mkdir -p docker/kibana
$ cd docker/kibana
$ vim Dockerfile
$ vim kibana.yml
FROM centos:6.6

RUN yum -y update

RUN yum install -y wget tar

ENV KIBANA_PKG_NAME kibana-4.1.4-linux-x64
RUN cd /
RUN tar xvzf $KIBANA_PKG_NAME.tar.gz
RUN rm -f $KIBANA_PKG_NAME.tar.gz
RUN mv /$KIBANA_PKG_NAME /kibana
RUN cp /kibana/config/kibana.yml /kibana/config/
ADD kibana.yml /kibana/config/

CMD ["/kibana/bin/kibana"]

# Kibana is served by a back end server. This controls which port to use.
port: 5601

# The host to bind the server to.
host: ""

# The Elasticsearch instance to use for all your queries.
elasticsearch_url: "http://es_alias:9200"

# preserve_elasticsearch_host true will send the hostname specified in `elasticsearch`. If you set it to false,
# then the host you use to connect to *this* Kibana instance will be sent.
elasticsearch_preserve_host: true

# Kibana uses an index in Elasticsearch to store saved searches, visualizations
# and dashboards. It will create a new index if it doesn't already exist.
kibana_index: ".kibana"

# If your Elasticsearch is protected with basic auth, this is the user credentials
# used by the Kibana server to perform maintence on the kibana_index at statup. Your Kibana
# users will still need to authenticate with Elasticsearch (which is proxied thorugh
# the Kibana server)
# kibana_elasticsearch_username: user
# kibana_elasticsearch_password: pass

# If your Elasticsearch requires client certificate and key
# kibana_elasticsearch_client_crt: /path/to/your/client.crt
# kibana_elasticsearch_client_key: /path/to/your/client.key

# If you need to provide a CA certificate for your Elasticsarech instance, put
# the path of the pem file here.
# ca: /path/to/your/CA.pem

# The default application to load.
default_app_id: "discover"

# Time in milliseconds to wait for elasticsearch to respond to pings, defaults to
# request_timeout setting
# ping_timeout: 1500

# Time in milliseconds to wait for responses from the back end or elasticsearch.
# This must be > 0
request_timeout: 300000

# Time in milliseconds for Elasticsearch to wait for responses from shards.
# Set to 0 to disable.
shard_timeout: 0

# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying
# startup_timeout: 5000

# Set to false to have a complete disregard for the validity of the SSL
# certificate.
verify_ssl: true

# SSL for outgoing requests from the Kibana Server (PEM formatted)
# ssl_key_file: /path/to/your/server.key
# ssl_cert_file: /path/to/your/server.crt

# Set the path to where you would like the process id file to be created.
# pid_file: /var/run/

# If you would like to send the log output to a file you can set the path below.
# This will also turn off the STDOUT log output.
# log_file: ./kibana.log

# A value to use as a XSRF token. This token is sent back to the server on each request
# and required if you want to execute requests from other clients (like curl).
# xsrf_token: ""

# Plugins that are included in the build, and no longer found in the plugins/ folder
 - plugins/dashboard/index
 - plugins/discover/index
 - plugins/doc/index
 - plugins/kibana/index
 - plugins/markdown_vis/index
 - plugins/metric_vis/index
 - plugins/settings/index
 - plugins/table_vis/index
 - plugins/vis_types/index
 - plugins/visualize/index


$ docker build --no-cache=true -t centos6/kibana .


$ docker run --name kibana --link es:es_alias -t -i -d  -p 5601:5601 centos6/kibana


$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
6a68ea6bccd6        centos6/kibana      "/kibana/bin/kibana"     5 seconds ago       Up 5 seconds>5601/tcp                           kibana
1663201be1f3        centos6/es          "/elasticsearch/bin/e"   1 minutes ago       Up 1 minutes>9200/tcp,>9300/tcp   es


Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away