Here’s a little post on how to run a Cacti and MySQL instance using docker.
I’t based on the million12/mariadb and polinux/cacti docker image and should get you started with it.
So let’s assume you’re already running a CentOS/RHEL 7 system with docker installed which has the IP address 192.168.99.100. The following code with then start a MySQL/MariaDB server:
docker run -d --name cacti-db -p 3306:3306 --env="MARIADB_USER=cactiuser" --env="MARIADB_PASS=my_password" million12/mariadb
The next command will get your Cacti system up and running
docker run -d --name cacti -p 80:80 -p 443:443 --env="DB_ADDRESS=192.168.99.100" --env="DB_USER=cactiuser" --env="DB_PASS=my_password" polinux/cacti
You can check any issues with the logs command
docker logs cacti
You probably need to have some firewall rules enabled as well. The following lines one the docker host will enable this:
firewall-cmd --permanent --zone=public --add-service=mysql firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload
Things to take care of:
The Cacti database will need to be backed up regularly. Especially keep in mind that the data is not persisten once you stop and remove the database container.
As with the database, the rrd files from the Cacti container will need to be backed up regularly as well. Alternatively you can mount a NFS share into the container to hold the rrd files