We are already using Docker and container based implementations during development, package builds and tests. This helps speed up development quite a lot next to the fancy Vagrant boxes. Since we’ve seen community members creating docker images for everything we thought we’d give it a try for our own official Docker container – our notebooks used in live demos at Icinga Camps certainly say thanks ;)
One problem arises – Docker containers are not made for running multiple applications, you would normally run each application inside its own container, and only export volumes and ports for communication links. A demo environment for Icinga 2 requires as least:
- Web server (httpd, apache2, etc)
- Database server (MariaDB, etc)
- Icinga 2 daemon
Furthermore we want to serve Icinga Web 2 as primary frontend and need to export port 80 for browser access. Even with SSH access for whatever comes to mind.
There’s already a Debian based Docker container using supervisord starting multiple applications in foreground. Taking this example whilst adding our own requirements into a CentOS7 based container (similar to the Vagrant boxes) leads us to our very own icinga2 Docker container.
It requires you to have at least Docker v1.6.0+ installed, then fire away and bind port 80 to your host’s port 3080:
$ sudo docker run -ti -p 3080:80 icinga/icinga2
Navigate to http://localhost:3080/icingaweb2/ and login using icingaadmin/icinga as credentials.
Keep in mind that the Docker container was made for test, development and demo purposes without any further production support.
If you’re planning to try Icinga Web 2 for example and want to test your own local patches, just mount the exported volumes like this:
$ sudo docker run -ti -p 3081:80 -v /usr/share/icingaweb2 /etc/icingaweb2 icinga/icinga2
There are additional volumes for /etc/icinga2 and /var/lib/icinga2 available. If you’re planning to modify the container image, you’ll find all required instructions inside the git repository.
On the long run, one might think of an Icinga 2 application cluster based on Docker containers. Who knows – happy testing & sending patches! :-)