Docker App Tutorial – Creating a docker container for ELK (Elasticsearch + Logstash + Kibana)

This is very quick tutorial for beginners to get up to speed with docker.

Docker Installation in OSX:
1. Download boot2docker package from
2. Run the package after download to install to applications.
3. Launch boot2docker from Apps, it will open in a terminal with a bash interface.
4. Run: “docker version” to test docker installation.

Getting a base docker image
To get a base Ubuntu image, run: docker pull ubuntu:14.04
Test the ubuntu image by: docker run ubuntu:14.04 echo “hello world”. You could also skip step 1 as if ubuntu:14.04 was not present it will be pulled when trying to run.
Get a terminal to the ubuntu server within docker: docker run -t -i ubuntu:14.04 /bin/bash

Creating custom docker image with ELK
1. Create a new docker file.
bash-3.2$ pwd
bash-3.2$ touch Dockerfile

2. Add contents from link to the docker file. The comments should make the file self explanatory.

3. Create an image with the docker file
bash-3.2$ docker build -t=”username/elk” .

4. Start elastic search.
bash-3.2$ docker run -d -p 80:80 -p 3333:3333 -p 9200:9200 username/elk /

5. If running in mac, get the IP of the VM. If Linux this will be the same IP as host.
bash-3.2$ boot2docker ip
The VM’s Host only interface IP address is:

6. Launch Kibana from

7. Send some test messages to logstash.
echo ‘A test message1’ | nc 3333
echo ‘A test message2’ | nc 3333
echo ‘A test message3’ | nc 3333
echo ‘A test message4’ | nc 3333

8. Goto the sample dashboard in Kibana and you should see these messages.

Trying out this container from my docker hub repository
Use “sudo” before commands if required.
Make sure docker is installed.
Run: docker pull cyberabis/docker-elkauto
Run: docker run -d -p 80:80 -p 3333:3333 -p 9200:9200 cyberabis/docker-elkauto /
Launch Kibana at port 80 of your docker!


One thought on “Docker App Tutorial – Creating a docker container for ELK (Elasticsearch + Logstash + Kibana)

  1. Pingback: Why Docker is awesome for a lean Tech Startup | Data Psyche

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s