bfren/mariadb

By bfren

Updated about 5 hours ago

MariaDB image based on Alpine Linux, with automated backups and optional SSL support.

Image

50K+

Docker MariaDB

GitHub release (latest by date)Docker PullsDocker Image SizeGitHub Workflow Status

Docker Repository - bfren ecosystem

MariaDB comes pre-installed (10.5 LTS, 10.6 LTS, 10.11 LTS, 11.1, 11.2, 11.4 LTS, 11.5 and 11.6) with automatic backups built-in.

If you are upgrading to 7.x please read this page.

Contents

Automatic Backups

Backups for every database (except mysql, information_schema, performance_schema, and sys) are stored:

  • in the /backup volume
  • in subfolders by date and time (yyMMddhhmm)
  • every eight hours

See For Backups for configuration variables.

It is strongly recommended that you run a backup before updating to a more recent version.

Ports

  • 3306

Volumes

VolumePurpose
/backupBackup files (also used for export / import scripts - see helper functions).
/dataData files.
/sslSSL certificates and files.

Environment Variables

For Backups
VariableValuesDescriptionDefault
BF_DB_BACKUP_COMPRESS_FILES0 or 1Whether or not to compress backup files (using gzip).0
BF_DB_BACKUP_KEEP_FORNu durationThe period of time to keep backups before auto-deleting them.28day
For SSL
VariableValuesDescriptionDefault
BF_DB_SSL_ENABLE0 or 1Set to "1" to enable SSL support.0
BF_DB_SSL_EXPIRYNu durationThe period of time before self-generated SSL certificates will expire.36500day
BF_DB_SSL_CA_KEY_BITSintegerThe size in bits of the CA SSL private key.4096
BF_DB_SSL_SERVER_KEY_BITSintegerThe size in bits of the server SSL private key.4096
BF_DB_SSL_CLIENT_KEY_BITSintegerThe size in bits of the client SSL private key.4096
For Database
VariableValuesDescriptionDefault
BF_DB_ROOT_PASSWORDstringPassword for root user.None - required
BF_DB_APPLICATIONstringApplication name - will be used as BF_DB_DATABASE, BF_DB_PASSWORD and BF_DB_USERNAME if they are not set.None
BF_DB_DATABASEstringDatabase name(s) - multiple databases can be separated by a comma.None
BF_DB_USERNAMEstringApplication username - required if BF_DB_APPLICATION is not used.None
BF_DB_PASSWORDstringApplication password - required if BF_DB_APPLICATION is not used.None
BF_DB_SUPER_USER0 or 1Grants the application user permission to all databases plus user management - not for production.0
BF_DB_CHARACTER_SETstringSets character_set_server.utf8
BF_DB_COLLATIONstringSets collation_server.utf8_general_ci
BF_DB_LOG_WARNINGSstringSets log_warnings.2

Helper Functions

FunctionArgumentsPurposeUsage
db-backupNoneRun backup manually.docker exec <<CONTAINER>> db-backup
db-export1: Database nameDumps the specified database as a SQL file to the root of the /backup volume.docker exec <<CONTAINER>> db-export <<DB_NAME>>
db-import1: Database nameExecutes all files in the root of the /backup volume.docker exec <<CONTAINER>> db-import <<DB_NAME>>
db-restore1: Backup setDeletes all files in /data volume, then restores from the specified backup dump.docker exec <<CONTAINER>> db-restore 202107180500
db-upgradeNoneRun mariadb-upgrade manually - normally not necessary but performs various checks.docker exec <<CONTAINER>> db-upgrade
db-enable-super-userNoneGive the application user permission to access all database and manage users.docker exec <<CONTAINER>> db-enable-super-user
db-disable-super-userNoneGive the application user permission only to access application databases.docker exec <<CONTAINER>> db-disable-super-user

Licence

Copyright

Copyright (c) 2020-2025 bfren (unless otherwise stated)

Docker Pull Command

docker pull bfren/mariadb