To address this challenge, KiwiBackup developed a method that allows you to back up a MySQL or MariaDB container directly from a dedicated container, without relying on the host server.

The concept is simple: deploy a backup container that includes the necessary tools (cron, mysqldump, rotation scripts) to automate database backups in Docker environments.

This approach helps you:

  • simplify deployments,
  • secure backups,
  • centralize backup tasks,
  • remain compatible with Docker Swarm architectures and distributed infrastructures.

Simply add the backup image to your docker-compose file and provide the required information:

db:
  image: mysql
  environment:
    MYSQL_ROOT_PASSWORD: XXX
  volumes:
    - /data/volumes/mysql-db:/var/lib/mysql

backup:
  image: kiwibackup/mysqlbackup
  environment:
    - DBHOST=db
    - DBPASS=XXX
    - DBLOGIN=root
    - CRONH=1
    - CRONM=19
  volumes:
    - /data/backup/db:/backup

You can then configure:

  • MySQL/MariaDB credentials,
  • backup times,
  • the storage folder,
  • the dump retention policy.

Backup: a pillar of cyber resilience

A Docker infrastructure without a backup policy remains vulnerable to human error, failures and cyberattacks. Protecting MySQL and MariaDB databases must now be an integral part of any business continuity and cyber resilience strategy.