Running Graphite and Grafana in Docker

I’ve been playing with Docker quite a bit lately and think it is some really cool stuff.  Check out the blog of one of my colleagues for more information on using it.  In short, entire application environments can be pulled from a catalog and started on a host with a single command.

I decided to find some Graphite and Grafana images and modify them for use specifically with Harvest and OPM.  The Graphite image has custom retention periods in the storage-schemas.conf for Harvest and OPM and the Grafana image is streamlined to work with this particular Graphite image.  You can now have Graphite and Grafana up and running with just a few commands now.  All the hard work is out of the way!

  1. Get a few utilities to make things a little easier later and install perl and some libraries that we’ll need later.


    yum install epel-release nfs-utils nano wget net-tools perl-Time-HiRes perl-XML-Parser perl-Net-SSLeay perl-libwww-perl device-mapper-event-libs –y


    sudo apt-get install nfs-common wget libwww-perl liblwp-protocol-https-perl libxml-parser-perl libmath-round-perl
  2. Install Docker and start the service.  You may need to disable the firewall on CENTOS/RHEL.


    yum install docker-io
    service docker start


    wget -qO- | sh
    service docker start
  3. Create /opt/graphite/storage/whisper directory so that the Docker Graphite container can store data in the host file system rather than within the container itself.  This allows a lot more flexibility for later.
  4. Pull and run the Docker image for Graphite.  This command will pull and launch the Graphite image using TCP/8080 as the port to access graphite-web and expose TCP/2003 to send data to carbon-cache.  The reason we use TCP/8080 for graphite-web is so that we can use TCP/80 for Grafana.  There are several Graphite images on the Docker registry, but I modified this one to set the retention periods for Harvest.
    docker run -d \
    –name=graphite \
    -v /opt/graphite/storage/whisper:/opt/graphite/storage/whisper \
    -p 8080:80 \
    -p 2003:2003 \
    -p 8125:8125/udp \

    Verify it is running by browsing to http://<dockerhost>:8080.  You should see the default Graphite browser.
  5. Pull and run the Grafana image.  This image uses the Graphite container in the previous step as the data source and InfluxDB for dashboard storage.
    docker run –d \
    –name=grafana \
    -p 80:80 \
    -p 8083:8083 \
    -p 8086:8086 \

Browse to http://<dockerhost> and you should see the Grafana default screen.