Ajeet Raina Docker Captain, ARM Innovator & Docker Bangalore Community Leader.

Building Data Persistent & Datacenter Asset Reporting Capability with Racktables running inside Docker container

3 min read

Let’s talk about Docker inside the datacenter..

If you are a datacenter administrator and still scouring through a spreadsheet of “unallocated” IP addresses, tracking asset and service tag of your individual computer hardware systems, maintaining quite complex documentation of the racks, devices, links and network resources you have in control etc., you definitely need a robust asset management tool. Racktables is one of the most popular and lightweight tool which you can rely upon.

Racktables is a smart and robust solution for datacenter and server room asset management. It helps document hardware assets, network addresses, space in racks, networks configuration and much much more!

With RackTables you can:

  • Have a list of all devices you’ve got
  • Have a list of all racks and enclosures
  • Mount the devices into the racks
  • Maintain physical ports of the devices and links between them
  • Manage IP addresses, assign them to the devices and group them into networks
  • Document your NAT rules
  • Integrate Nagios, Cacti, Munin, Zabbix etc. as plugin directly into UI
  • Describe your loadbalancing policy and store loadbalancing configuration
  • Attach files to various objects in the system
  • Create users, assign permissions and allow or deny any actions they can do
  • Label everything and even everyone with flexible tagging system

Shown below is the screenshot of Racktables elements which comprises of Rackspace, Objects, IPv4 & IPv6 space, Virtual Respources, Logs, Configuration settings, IP SLB, 820.1Q, Patches & Cables.

My Image

Shown below is the reporting plugin which we are going to integrate into Racktables all using Docker containers. In case you’re new, Plugins provide the ability to add functionality to RackTables and, in some cases, override existing behavior. See the racktables-contribs repository for user-submitted plugins.

My Image

Racktables is a great tool based on LAMP stack. Sometimes it becomes cumbersome to install & manage this tool as you can expect great deal of dependencies around its packages for various distros of Linux.

If you visit https://www.freelists.org/list/racktables-users , you will notice numerous issues faced by first time Lab admins to build this platform with desired plugins and manage them. To simplify this, I started looking out how to build high persistent Racktables tool along with plugins integration & reporting capabilities.

Here’s a 2 min guide to setup Racktables along with its effective plugins inside Docker container:

Tested Infrastructure

PlatformNumber of InstanceReading Time
Ubuntu 18.04 VM15 min


  • Install Ubuntu 18.04 VM either on VM or Bare Metal system
  • Install Docker & Docker Compose

Install Docker

curl -sSL https://get.docker.com/ | sh

Install Docker Compose

curl -L https://github.com/docker/compose/releases/download/1.24.0-rc1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

Clone this Repository

git clone https://github.com/collabnix/racktables-docker
cd racktables-docker

Install Docker

curl -sSL https://get.docker.com/ | sh

[Optional]Configuring DNS for your Docker container(in case you’re behind the firewall)

Edit daemon.json file and restart the docker daemon using “systemctl restart docker” command:

 cat /etc/docker/daemon.json
"dns": [""]

Bring up Racktables Services using Docker Compose

All you need is a Dockerfile & Docker compose file which brings up microservices together to build up Racktables tool. Under Dockerfile, you can add plugins of your choice. Under this example, I have added Reporting plugin so as to generate reports like who is the owner of the specific HW parts, how many number of specific types of components are present and so on..

The Content of Dockerfile look like

# vim: set ft=dockerfile:
FROM alpine:3.6
# Author with no obligation to maintain
MAINTAINER Ajeet Singh Raina aj********@gm***.com>

ENV DBHOST="mariadb" \
    DBNAME="racktables" \
    DBUSER="racktables" \

COPY entrypoint.sh /entrypoint.sh
RUN apk update
RUN apk --no-cache add \
    ca-certificates \
    curl \
    php5-bcmath \
    php5-curl \
    php5-fpm \
    php5-gd \
    php5-json \
    php5-ldap \
    php5-pcntl \
    php5-pdo_mysql \
    php5-snmp \
    && chmod +x /entrypoint.sh \
    && curl -sSLo /racktables.tar.gz 'https://github.com/RackTables/racktables/archive/RackTables-0.21.1.tar.gz' \
    && mkdir /opt \
    && tar -xz -C /opt -f /racktables.tar.gz \
    && mv /opt/racktables-RackTables-0.21.1 /opt/racktables \
    && rm -f /racktables.tar.gz \
    && sed -i \
    -e 's|^listen =.*$|listen = 9000|' \
    -e 's|^;daemonize =.*$|daemonize = no|' \

# Adding Plugins for Racktable Reports

RUN apk add git \
   && git clone https://github.com/collabnix/racktables-contribs \
   && cd racktables-contribs/extensions \
   && cp -r plugins/* /opt/racktables/plugins/

VOLUME /opt/racktables/wwwroot
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/bin/php-fpm5"]

The content of Docker Compose file look like this:

  image: mariadb
  - MYSQL_DATABASE=racktables
  - MYSQL_USER=racktables
  - MYSQL_PASSWORD=password123
  - ./db_data:/var/lib/mysql

  build: .
  - mariadb
  - DBHOST=mariadb
  - DBNAME=racktables
  - DBUSER=racktables
  - DBPASS=password123
  image: nginx:stable-alpine
  - racktables
  - racktables
  - ./nginx.conf:/etc/nginx/nginx.conf
  - 80:80

cd racktables-docker
docker-compose build
docker-compose up -d 

Accessing Racktables UI

Start by browsing to http://localhost/?module=installer&step=5

Please don’t forget to add /?module=installer&step=5 at the end of the URL. Click on “Next”, enter your new password. Login as “admin” and “your new password”. That’s it. Here you have ~ your new Racktables tool installed along with Reporting + Data persistent capabilities.

If you browse to Main Page > Reports section you will see “Custom”, “Server”, “Switches”, “Virtual Machines” getting added automatically as shown below:

My Image

Did we talk about data persistence?

Containers are ephemeral in nature. Depending upon your frequent changes, there could be chances that your container might go down anytime and your application become inaccessible. No worry…As data persistence capability is already implemented, you need not worry about loosing your data.

The below code under Docker compose takes care of this functionality:

  image: mariadb
  - MYSQL_DATABASE=racktables
  - MYSQL_USER=racktables
  - MYSQL_PASSWORD=password123
  - ./db_data:/var/lib/mysql

Hope you found this blog informative. If you are facing any issue, feel free to raise any issue under https://github.com/collabnix/racktables-docker.

In my future blog post, I will talk about additional monitoring plugins which can be integrated into Racktables using Docker containers.


  • https://www.freelists.org/list/racktables-users
  • https://github.com/RackTables/racktables-contribs
Please follow and like us:

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Docker Captain, ARM Innovator & Docker Bangalore Community Leader.

Leave a Reply

Your email address will not be published. Required fields are marked *

© Copyright Collabnix Inc

Built for Collabnix Community, by Community