Sign inSign up

tractr/mysql-backup

By tractr

Updated about 5 years ago

https://github.com/tractr/docker-images/tree/main/backups/mysql

Image
0

482

tractr/mysql-backup repository overview

Using a prepost strategy to create mySQL backups

Volumerize can execute scripts before and after the backup process.

With this prepost strategy you can create a .sql backup of your MySQL containers and save it with Volumerize.

Environment Variables

Aside of the required environment variables by Volumerize, this prepost strategy will require a couple of extra variables.

NameDescription
MYSQL_USERNAMEUsername of the user who will perform the restore or dump.
MYSQL_PASSWORDPassword of the user who will perform the restore or dump.
MYSQL_HOSTIP or domain of the host machine.
MYSQL_DATABASEDatabase to backup / restore.

Example with Docker Compose

version: "2"

services:
  mariadb:
    image: mariadb
    ports:
      - 3306:3306
    environment:
      - MYSQL_ROOT_PASSWORD=1234
      - MYSQL_DATABASE=somedatabase
    volumes:
      - mariadb:/var/lib/mysql

  volumerize:
    image: tractr/mysql-backup
    environment:
      - VOLUMERIZE_SOURCE=/source
      - VOLUMERIZE_TARGET=file:///backup
      - MYSQL_USERNAME=root
      - MYSQL_PASSWORD=1234
      - MYSQL_HOST=mariadb
      - MYSQL_DATABASE=somedatabase
    volumes:
      - volumerize-cache:/volumerize-cache
      - backup:/backup
    depends_on:
      - mariadb

volumes:
  volumerize-cache:
  mariadb:
  backup:

Then execute docker-compose exec volumerize backup to create a backup of your database and docker-compose exec volumerize restore to restore it from your backup.

Tag summary

Content type

Image

Digest

Size

196.3 MB

Last updated

about 5 years ago

docker pull tractr/mysql-backup