A series of tips and tricks to get you up and running with docker
In Part 1 I covered setting up and running dockprom a containeried monitoring solution for Docker and its host. Now I will configure the alerts it is possible to send yourself should anything go awry.
Most of the projects I work on have strict rules regarding data privacy, using a SaaS outside EU it's not possible and even if so, I would not opt for an external service, paid or not, if I have a viable self-hosted open source solution. So I’ve been looking for an open source, self-hosted monitoring solution that can provide metrics storage, visualisation and alerting for physical servers, virtual machines, containers and services that are running inside containers. After trying out several others and Prometheus I’ve settled-on Prometheus, primarily due to its support for multi-dimensional metrics and the query language that’s easy to grasp.
In previous tutorials I have built standalone containers i.e. everything in one “box”, webserver, application and database. One can see how building several containers like this for multiple applications will involve a lot of uneccessary duplication, storage, and processing. Docker is an ideal tool split these services into separate blocks and allow them to interact with each other seamlessly.
In previous tutorials we have accessed the docker applications by binding the containers exposed port 80 to a host port. If there is already a web application/s running on the host using port 80 then the containers port needs to bound to a redundant host port say 81 or upwards. Whilst this works in practice it is not very elegant.
One of the more important features of Docker is image content management, or image layering. Docker’s layered approach to images (or content) provides a very powerful abstraction for building up application containers. An image provides the foundation layer for a container. New tools, applications, content, patches, etc. form additional layers on the foundation. Containers are workable instances of these combined entities, which can then be bundled into it’s own image.
Provision a KVM Virtual Private Server on BHost with a 64 bit operating system of your choice. For the purpose of my tutorials I shall be using Debian 8. Most of the commands I will be demonstrating are from Docker itself and independent of the operating system, however you will have to adapt OS shell commands such as apt-get to suit yourself e.g. yum in Fedora.