Ubuntu: Install Elasticsearch as Docker Container and manage it nicely in GUI

Submitted by Peter Majmesku on Fri, 12/09/2016 - 14:16
Elasticsearch Logo

Install Docker

Firstly install Docker via this article: https://docs.docker.com/engine/installation/linux/ubuntulinux/. Mind to setup the user and group permissions according to the article. So that you are able to start Docker as non-root user.

Check your user's group setting

Make sure that a group with the name "docker" exists and your user is a member of that group. To add a user to an existing group, execute the following command:

sudo usermod -a -G groupName userName

After your user (mine f.e. is "peter") is being successfully added into the "docker" group, logout and login to ensure that you are acting from the docker user group.

Install Kitematic

Dowload the Kitematic GUI for Docker Debian package via https://github.com/docker/kitematic/releases. This program will empower you, to manage your Docker containers easily via a graphical user interface. Mind that this application is currently beta. Then install it by

sudo dpkg -i dist/Kitematic_0.12.9_amd64.deb
Kitematic - GUI for Docker

Install Elasticsearch as Docker Container by Kitematic

Follow the following steps in Kitematic:

  1. Hit the "New"-Button
  2. Search for "elasticsearch" to see the official Elasticsearch Docker Container in the search result list
  3. Choose the version you want via the tag (version 1.7.2 is the version which works for me)
  4. Hit the button which is labeled with "Create". Kitematic will now install the Elasticsearch Docker container for you.
Kitematic Elasticsearch installation

GUI for Elasticsearch: Jettro

To be able to execute easily queries within Elasticsearch, check status etc., you can install Jettro (https://github.com/jettro/elasticsearch-gui). Just execute the following command inside your Elasticsearch Docker container to install the Elasticsearch plugin:

bin/plugin install jettro/elasticsearch-gui 

Jettro - GUI for Elasticsearch inside the webbrowser

Start the Docker Container automatically on system startup as a Daemon

An official tutorial about this can be found here: https://docs.docker.com/engine/admin/host_integration/. In particular, you can follow the steps below.

Create a file at 

/etc/systemd/system/docker-elasticsearch.service

with the following content:

[Unit]
Description=Elasticsearch container
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStart=/usr/bin/docker start -a elasticsearch
ExecStop=/usr/bin/docker stop -t 2 elasticsearch

[Install]
WantedBy=default.target

Now reload the daemon:

sudo systemctl daemon-reload

Start the Elasticsearch Docker container as a service:

sudo systemctl start docker-elasticsearch.service

Enable the service at system startup:

sudo systemctl enable docker-elasticsearch.service

Voilà! Happy search index querying. (:

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.