• Stars
    star
    11
  • Rank 1,694,829 (Top 34 %)
  • Language
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Docker MariaDB server w/ S6 Overlay, Zabbix Monitoring based on Alpine

github.com/tiredofit/docker-mariadb

GitHub release Build Status Docker Stars Docker Pulls Become a sponsor Paypal Donate

About

This will build a Docker image for MariaDB. A relational database forked from MySQL.

  • Configuration tweaked to use all around settings for general usage - Can be changed
  • Can use official Mysql/MariaDB environment variables (MYSQL_USER, MYSQL_PASSWORD, MYSQL_ROOT_PASSWORD)
  • Allows for automatically creating multiple databases on container initialization and subsequent reboots
  • Automatic Table/DB Upgrade support if MariaDB version has changed
  • Includes MySQL Tuner inside image to optimize your configuration
  • Logging with automatic rotation
  • Zabbix Monitoring for metrics

Also has the capability of backing up embedded in the container based on the tiredofit/dbbackup image which includes the following features:

  • dump to local filesystem
  • Backup all databases
  • choose to have an MD5?SHA sum after backup for verification
  • delete old backups after specific amount of time
  • choose compression type (none, gz, bz, xz,zstd)
  • select how often to run a dump
  • select when to start the first dump, whether time of day or relative to container start time

Maintainer

Table of Contents

Installation

Build from Source

Clone this repository and build the image with docker build <arguments> (imagename) .

Prebuilt Images

Builds of the image are available on Docker Hub

docker pull docker.io/tiredofdit/mariadb:(imagetag)

Builds of the image are also available on the Github Container Registry

docker pull ghcr.io/tiredofit/docker-mariadb:(imagetag)

The following image tags are available along with their tagged release based on what's written in the Changelog:

Version Container OS Tag
latest Alpine :latest
10.11.x Alpine :10.11
10.10.x Alpine :10.10
10.9.x Alpine :10.9
10.8.x Alpine :10.8
10.6.x Alpine :10.6
10.5.x Alpine :10.5

Multi Architecture

Images are built primarily for amd64 architecture, and may also include builds for arm/v7, arm64 and others. These variants are all unsupported. Consider sponsoring my work so that I can work with various hardware. To see if this image supports multiple architecures, type docker manifest (image):(tag)

Configuration

Quick Start

  • The quickest way to get started is using docker-compose. See the examples folder for a working compose.yml that can be modified for development or production use.

  • Set various environment variables to understand the capabilities of this image.

  • Map persistent storage for access to configuration and data files for backup.

Persistent Storage

The following directories are used for configuration and can be mapped for persistent storage.

Directory Description
/var/lib/mysql MySQL Data Directory
/etc/mysql/conf.d Optional directory to put .cnf files for additional directives
/backup Optional directory for backups

Environment Variables

Base Images used

This image relies on an Alpine Linux base image that relies on an init system for added capabilities. Outgoing SMTP capabilities are handlded via msmtp. Individual container performance monitoring is performed by zabbix-agent. Additional tools include: bash,curl,less,logrotate,nano,vim.

Be sure to view the following repositories to understand all the customizable options:

Image Description
OS Base Customized Image based on Alpine Linux

Container Options

Parameter Description Default
CERT_PATH Certs Path
CONFIG_FILE Configuration File to load - Not needed to be set my.cnf
CONFIG_PATH Configuration Path /etc/mysql/
CONFIG_CUSTOM_PATH Configuration Override Path ${CONFIG_PATH}/conf.d
DATA_PATH Data Files Path /var/lib/mysql/
LOG_PATH Log Files Path /logs/
SOCKET_FILE Socket Name mysqld.sock
SOCKET_PATH Socket Path /run/mysqld/

MariaDB Options

Parameter Description Default _FILE
CHARACTER_SET Set Default Character Set utf8mb4
COLLATION Set Default Collation utf8mb4_general_ci
DB_AUTO_UPGRADE If MariaDB has changed from first time image has been used, automatically upgrade DBs and tables to latest versions - TRUE / FALSE TRUE
DB_CONFIGURATION Type of Configuration - standard, or default standard
LISTEN_PORT Listening Port 3306
ROOT_PASS Root Password for Instance (e.g. password) x
MYSQLD_ARGS Add extra arguments to the mariadb execution
  • With regards to DB_CONFIGURATION
    • default - Means the default my.cnf file from MariaDB
    • standard - My own settings that I find work for my own DB servers.

Database Options

Automatically create user databases on startup. This can be done on each container start, and then removed on subsequent starts if desired.

Parameter Description Default _FILE
CREATE_DB Automatically create databases on startup TRUE
DB_NAME Database Name e.g. database x
DB_USER Database User e.g. user x
DB_PASS Database Pass e.g. password x

OR

Create multiple databases and different usernames and passwords to access. You can share usernames and passwords for multiple databases by using the same user and password in each entry.

Parameter Description Default _FILE
DB01_NAME First Database Name e.g. database1 x
DB01_USER First Database User e.g. user1 x
DB01_PASS First Database Pass e.g. password1 x
DB02_NAME Second Database Name e.g. database1 x
DB02_USER Second Database User e.g. user2 x
DB02_PASS Second Database Pass e.g. password2 x
DBXX_... As above, should be able to go all the way to 99

Logging Options

Parameter Description Default
ENABLE_LOG_ERROR Enable Error Logging TRUE
ENABLE_LOG_GENERAL_QUERY Log all connections and queries to server (performance hit!) FALSE
ENABLE_SLOW_QUERY_LOG Log all slow queries FALSE
LOG_PATH Path where logs are stored /logs/
LOG_FILE_ERROR Error Log File Name error.log
LOG_FILE_GENERAL_QUERY General Query Log File name general.log
LOG_FILE_SLOW_QUERY Slow Query Log File Name slow_query.log
LOG_LEVEL Log Level for warnings 0 to 9 3

Backup Options

The backup functionality is a subset of the tiredofit/db-backup image. Please have a peek at the README to understand ways to use. All features have been carried over with the exception of being able to backup remote systems - It is hardcoded to connect to the MariaDB socket not requiring DB_HOST/DB_PORT variables.

Parameter Description Default
DB_BACKUP_BACKUP_LOCATION Backup to FILESYSTEM or S3 compatible services like S3, Minio, Wasabi FILESYSTEM
DB_BACKUP_MODE AUTO mode to use internal scheduling routines or MANUAL to simply use this as manual backups only executed by your own means AUTO
DB_BACKUP_MANUAL_RUN_FOREVER TRUE or FALSE if you wish to try to make the container exit after the backup TRUE
DB_BACKUP_TEMP_LOCATION Perform Backups and Compression in this temporary directory /tmp/backups/
DB_BACKUP_CREATE_LATEST_SYMLINK Create a symbolic link pointing to last backup in this format: latest-(DB_TYPE)-(DB_NAME)-(DB_HOST) TRUE
DEBUG_MODE If set to true, print copious shell script messages to the container log. Otherwise only basic messages are printed. FALSE
DB_BACKUP_PRE_SCRIPT Fill this variable in with a command to execute pre backing up
DB_BACKUP_POST_SCRIPT Fill this variable in with a command to execute post backing up
DB_BACKUP_SPLIT_DB For each backup, create a new archive. TRUE or FALSE (MySQL and Postgresql Only) TRUE
Database Options
Parameter Description Default _FILE
DB_BACKUP_NAME Schema Name e.g. database or ALL to backup all databases the user has access to. Backup multiple by seperating with commas eg db1,db2
DB_BACKUP_NAME_EXCLUDE If using ALL - use this as to exclude databases seperated via commas from being backed up
DB_BACKUP_USER username for the database(s) - Can use root x
DB_BACKUP_PASS (optional if DB doesn't require it) password for the database x
Scheduling Options
Parameter Description Default
DB_BACKUP_DUMP_FREQ How often to do a dump, in minutes after the first backup. Defaults to 1440 minutes, or once per day. 1440
DB_BACKUP_DUMP_BEGIN What time to do the first dump. Defaults to immediate. Must be in one of two formats
Absolute HHMM, e.g. 2330 or 0415
Relative +MM, i.e. how many minutes after starting the container, e.g. +0 (immediate), +10 (in 10 minutes), or +90 in an hour and a half
DB_BACKUP_DUMP_TARGET Directory where the database dumps are kept. /backup
DB_BACKUP_DUMP_TARGET_ARCHIVE Optional Directory where the database dumps archives are kept.
DB_BACKUP_CLEANUP_TIME Value in minutes to delete old backups (only fired when dump freqency fires). 1440 would delete anything above 1 day old. You don't need to set this variable if you want to hold onto everything. FALSE
DB_ARCHIVE_TIME Value in minutes to move all files files older than (x) from DB_BACKUP_DUMP_TARGET to DB_BACKUP_DUMP_TARGET_ARCHIVE - which is useful when pairing against an external backup system.
Other Backup Options
Parameter Description Default
DB_BACKUP_COMPRESSION Use either Gzip GZ, Bzip2 BZ, XZip XZ, ZSTD ZSTD or none NONE ZSTD
DB_BACKUP_COMPRESSION_LEVEL Numberical value of what level of compression to use, most allow 1 to 9 except for ZSTD which allows for 1 to 19 - 3
DB_BACKUP_ENABLE_PARALLEL_COMPRESSION Use multiple cores when compressing backups TRUE or FALSE TRUE
DB_BACKUP_PARALLEL_COMPRESSION_THREADS Maximum amount of threads to use when compressing - Integer value e.g. 8 autodetected
DB_BACKUP_GZ_RSYNCABLE Use --rsyncable (gzip only) for faster rsync transfers and incremental backup deduplication. e.g. TRUE FALSE
DB_BACKUP_ENABLE_CHECKSUM Generate either a MD5 or SHA1 in Directory, TRUE or FALSE TRUE
DB_BACKUP_CHECKSUM Either MD5 or SHA1 MD5
DB_BACKUP_EXTRA_OPTS If you need to pass extra arguments to the backup command, add them here e.g. --extra-command

Backing Up to S3 Compatible Services

If DB_BACKUP_LOCATION = S3 then the following options are used.

Parameter Description Default _FILE
DB_BACKUP_S3_BUCKET S3 Bucket name e.g. mybucket x
DB_BACKUP_S3_KEY_ID S3 Key ID (Optional) x
DB_BACKUP_S3_KEY_SECRET S3 Key Secret (Optional) x
DB_BACKUP_S3_PATH S3 Pathname to save to (must NOT end in a trailing slash e.g. 'backup') x
DB_BACKUP_S3_REGION Define region in which bucket is defined. Example: ap-northeast-2 x
DB_BACKUP_S3_HOST Hostname (and port) of S3-compatible service, e.g. minio:8080. Defaults to AWS. x
DB_BACKUP_S3_PROTOCOL Protocol to connect to S3_HOST. Either http or https. Defaults to https. https x
DB_BACKUP_S3_EXTRA_OPTS Add any extra options to the end of the aws-cli process execution x
DB_BACKUP_S3_CERT_CA_FILE Map a volume and point to your custom CA Bundle for verification e.g. /certs/bundle.pem x
OR
DB_BACKUP_S3_CERT_SKIP_VERIFY Skip verifying self signed certificates when connecting TRUE
  • When DB_BACKUP_S3_KEY_ID and/or DB_BACKUP_S3_KEY_SECRET is not set, will try to use IAM role assigned (if any) for uploading the backup files to S3 bucket.

Upload to a Azure storage account by blobxfer

Support to upload backup files with blobxfer to the Azure fileshare storage.

If DB_BACKUP_BACKUP_LOCATION = blobxfer then the following options are used.

Parameter Description Default _FILE
DB_BACKUP_BLOBXFER_STORAGE_ACCOUNT Microsoft Azure Cloud storage account name. x
DB_BACKUP_BLOBXFER_STORAGE_ACCOUNT_KEY Microsoft Azure Cloud storage account key. x
DB_BACKUP_BLOBXFER_REMOTE_PATH Remote Azure path /docker-db-backup

This service uploads files from backup targed directory DB_BACKUP_DUMP_TARGET. If the a cleanup configuration in DB_BACKUP_CLEANUP_TIME is defined, the remote directory on Azure storage will also be cleaned automatically.

Networking

The following ports are exposed.

Port Description
3306 MariaDB Server

Maintenance

Inside the image are tools to perform modification on how the image runs.

Shell Access

For debugging and maintenance purposes you may want access the containers shell.

docker exec -it (whatever your container name is) bash

Mysql Tuner

This image comes with Mysql Tuner. Simply enter inside the container and execute mysql-tuner along with your arguments.

Manual Backups

Manual Backups can be perforemd by entering the container and typing backup-now

Contributions

Welcomed. Please fork the repository and submit a pull request for any bug fixes, features or additions you propose to be included in the image. If it does not impact my intended usage case, it will be merged into the tree, tagged as a release and credit to the contributor in the CHANGELOG.

Support

These images were built to serve a specific need in a production environment and gradually have had more functionality added based on requests from the community.

Usage

  • The Discussions board is a great place for working with the community on tips and tricks of using this image.
  • Sponsor me for personalized support

Bugfixes

  • Please, submit a Bug Report if something isn't working as expected. I'll do my best to issue a fix in short order.

Feature Requests

  • Feel free to submit a feature request, however there is no guarantee that it will be added, or at what timeline.
  • Sponsor me regarding development of features.

Updates

  • Best effort to track upstream changes, More priority if I am actively using the image in a production environment.
  • Sponsor me for up to date releases.

License

MIT. See LICENSE for more details.

References

More Repositories

1

docker-freepbx

Dockerized FreePBX 15 w/Asterisk 17, Seperate MySQL Database support, and Data Persistence and UCP
496
star
2

docker-db-backup

Backup multiple database types on a scheduled basis with many customizable options
Dockerfile
472
star
3

docker-traefik-cloudflare-companion

Automatically Create CNAME records for containers served by Traefik
Python
274
star
4

docker-freescout

Dockerized Freescout Helpdesk
Dockerfile
146
star
5

docker-self-service-password

Dockerized LDAP Tollbox Self Service Password Changer with many customizable options
Dockerfile
115
star
6

docker-nginx-php-fpm

Dockerized Nginx + PHP FPM images with many customizable options
Dockerfile
106
star
7

docker-openldap

Dockerized OpenLDAP server with many customizable options
99
star
8

docker-jitsi-meet

Docker Jitsi Meet WebRTC conferencing system w/Prosody XMPP and s6 overlay
Dockerfile
64
star
9

docker-collabora-online

Dockerized Collabora Office Online with customizable options
Dockerfile
62
star
10

docker-osticket

Dockerized Help Desk Software
PHP
48
star
11

docker-tinc

Docker Tinc VPN Mesh server w/S6 Overlay Init, Zabbix Monitoring, and distributed configuration updating based on Alpine
Dockerfile
43
star
12

docker-postal

Dockerized Postal SMTP Server based on Alpine Linux and Ruby
Dockerfile
40
star
13

docker-fusiondirectory

Dockerized FusionDirectory LDAP Manager
Dockerfile
39
star
14

docker-lemonldap

Dockerized Authentication Server with Single Sign On SAML, OpenID Connect, CAS, and Header support
Dockerfile
39
star
15

docker-openldap-fusiondirectory

Dockerized OpenLDAP server with FusionDirectory Schema Support
34
star
16

docker-wordpress

Dockerized Wordpress Image with customizable options
Python
31
star
17

docker-alpine

Docker Alpine Linux Base Images
Dockerfile
30
star
18

docker-traefik

Dockerized Traefik Reverse Proxy with customizable options
Dockerfile
29
star
19

docker-mongodb-backup

Docker MongoDB Backup Container based on Alpine w/S6 init, Zabbix Monitoring
Dockerfile
28
star
20

docker-nginx-proxy-cloudflare-companion

Automatically update CNAME records when Docker container starts via Cloudflare
Python
27
star
21

docker-spamassassin

Docker Spamassassin Spam filtering based on Alpine Linux
Dockerfile
26
star
22

docker-clamav

Docker ClamAV Image with Zabbix Monitoring and Customizable Configuration
Dockerfile
23
star
23

docker-baserow

Dockerized Baserow No/Low code data management application based on Alpine
Dockerfile
22
star
24

docker-nginx

Dockerzed webserver with many customizable options
Dockerfile
22
star
25

docker-nextcloud

Dockerized Nextcloud Server with many customizable options
17
star
26

docker-gitlab-ee

Dockerized Gitlab Enterprise Edition
Dockerfile
17
star
27

docker-debian

Docker Debian Base Images
Dockerfile
15
star
28

docker-discourse

Dockerized Discourse Forum
Dockerfile
15
star
29

docker-backuppc

Docker BackupPC with Zabbix monitoring support
Perl
15
star
30

docker-gcds

Docker Google Cloud Directory Sync service (GADS) w/S6 Overlay, Zabbix Monitoring
Dockerfile
14
star
31

docker-mariadb-backup

Docker MariaDB Backup Container w/ S6 Overlay, Zabbix Monitoring based on Alpine
Dockerfile
13
star
32

docker-zabbix

Dockerized Zabbix Server, Proxy, and Frontend
Dockerfile
13
star
33

docker-insync

Docker Insync Headless Client
Dockerfile
12
star
34

docker-rspamd

Dockerized Anti Spam Filter
Python
12
star
35

docker-nginx-ldap

Docker Nginx Image w/LDAP Authentication, Zabbix agent monitoring, S6 init, logrotate based on Alpine
Dockerfile
11
star
36

docker-bookstack

Dockerized Information Manager
Dockerfile
11
star
37

docker-gitlab

Dockerized Gitlab CE w/Alpine Linux, Zabbix Monitoring and S6 Overlay
Dockerfile
10
star
38

docker-staytus

Docker Staytus Image w/s6 overlay, zabbix monitoring based on Alpine
HTML
10
star
39

docker-leantime

Dockerized Project Managment tool with many configurable options
Dockerfile
10
star
40

docker-otrs

Dockerized OTRS ITSM Helpdesk/Ticketing System based on Alpine w/Nginx
Dockerfile
9
star
41

docker-unbound

Docker Unbound DNS Resolver based on Alpine
Dockerfile
9
star
42

docker-postgres

Dockerized Postgresql Server with multiple databases/users, replication, and monitoring support
Dockerfile
9
star
43

docker-postfix

Dockerized MTA with many customizable features, LDAP, SASL, Milter, Relay Support
Dockerfile
8
star
44

docker-matomo

Dockerized Matomo (Piwik) Analytics
Dockerfile
8
star
45

docker-yourls

Dockerized YOURLS link shortener based on Alpine
Dockerfile
8
star
46

docker-invoiceninja

Dockerized Invoicing web application
Dockerfile
7
star
47

docker-nodejs

Docker NodeJS Base Images
7
star
48

docker-postfix-relay

Dockerized Postfix Relay for easy SMTP capabilities
Shell
7
star
49

docker-openvpn

Dockerized OpenVPN server w/Alpine+Debian Variants w/s6 overlay, and LDAP Authentication support
7
star
50

docker-rocketchat

Docker Rocketchat Server with S6 Initsystem and Zabbix Monitoring based on Alpine
6
star
51

docker-kopano

Dockerized Kopano Groupware server
Dockerfile
6
star
52

docker-n8n

Dockerized n8n workflow automation tool
Dockerfile
6
star
53

docker-listmonk

Dockerized Listmonk Mailing List server built iwth Alpine w/Zabbix Monitoring
Dockerfile
6
star
54

docker-cpuminer

Cryptocurrency Miner based on Alpine
6
star
55

docker-kopano-core

Dockerized Kopano Groupware Server
6
star
56

docker-grafana

Dockerfile
5
star
57

docker-moodle

Dockerized Moodle Learning Management System
Dockerfile
5
star
58

docker-loki

Dockerized Loki Log Analyzer
Dockerfile
5
star
59

docker-teampass

Dockerized Password Vault for Teams based on Alpine w/nginx,php-fpm
Dockerfile
5
star
60

docker-orbeon

Docker Orbeon Forms CE w/S6 Init, Tomcat, based on Alpine
Dockerfile
5
star
61

docker-redis

Docker Redis Server with S6 Initsystem and Zabbix Monitoring based on Alpine
5
star
62

docker-elasticsearch

Dockerized Elasticsearch based on Alpine linux
4
star
63

fusiondirectory-plugin-kopano

Plugin to manage users/groups for Kopano (fork of Zarafa) within Fusion Directory LDAP Manager
PHP
4
star
64

docker-novnc

Run GUI applications within a browser - Base image
Dockerfile
4
star
65

docker-flarum

Dockerized Flarum Web Forum Software based on Alpine
Shell
4
star
66

docker-registry

Dockerized Docker Registry
Dockerfile
4
star
67

docker-rabbitmq

Dockerized RabbitMQ server
Python
4
star
68

docker-gitlab-runner

Docker Gitlab runner w/ Zabbix monitoring support based on Alpine
4
star
69

docker-openeats

Dockerized Openeats Recipe manager based on Alpine Linux w/Zabbix Monitoring
Dockerfile
3
star
70

docker-restic

Dockerized Backup application
Dockerfile
3
star
71

docker-dovecot

Docker Dovecot IMAP server based on Alpine w/LDAP Support
TSQL
3
star
72

docker-uptimekuma

Dockerized Service availability monitoring system
Dockerfile
3
star
73

docker-draw-io

Docker Draw.IO image based on Alpine and Nginx
3
star
74

docker-logrotate

Docker Logrotate to keep logfiles compressed and rotated based on Alpine
Shell
3
star
75

docker-mailhog

Dockerized SMTP Test server
Dockerfile
3
star
76

docker-cachet

Dockerized Cachet Status monitoring application based on Alpine Linux
Dockerfile
3
star
77

docker-sentry

Dockerized Sentry.IO Exception tracking system based on Debian w/LDAP and SAML
Python
3
star
78

docker-airsonic-advanced

Dockerized Airsonic Advanced Server based on Alpine
Dockerfile
3
star
79

docker-limesurvey

Dockerized Limesurvey application based on Alpine
Dockerfile
3
star
80

docker-mongo

Docker MongoDB server w/ S6 Overlay, Zabbix Monitoring based on Alpine
3
star
81

docker-haraka

Docker Haraka MTA based on Alpine
JavaScript
3
star
82

docker-ruby

Docker Ruby base images w/ S6 Overlay and Zabbix monitoring support
3
star
83

docker-ubuntu

Dockerized Ubuntu Base Images
Dockerfile
2
star
84

docker-memcached

Docker Memcached Server w/ S6 Initsystem and Zabbix Monitoring based on Alpine
Dockerfile
2
star
85

home

Home-Manager configuration ala Nix flakes
Nix
2
star
86

docker-kopano-meet

Dockerfile
2
star
87

docker-soulseek

Dockerized Soulseek Client
Dockerfile
2
star
88

docker-kopano-kapi

Dockerfile
2
star
89

docker-kopano-konnect

Dockerfile
2
star
90

docker-olefy

Dockerized Olefy TCP listener for OLE Tools
Dockerfile
2
star
91

docker-logchimp

Dockerized Logchimp Application
Dockerfile
2
star
92

docker-transmission

Dockerized Transmission client
Dockerfile
2
star
93

docker-dind

Docker in Docker Image with Zabbix monitoring Support and --squash --compress options by default based on Alpine
Dockerfile
2
star
94

docker-matrix-bridges

Dockerized Matrix Bridges to interconnect services
Dockerfile
2
star
95

docker-monica

Dockerized Monica PRM
Dockerfile
2
star
96

tiredofit

2
star
97

docker-minio

Dockerized Minio Server based on Alpine
Dockerfile
2
star
98

docker-tomcat

Docker Apache Tomcat based on Alpine
2
star
99

docker-mongo-builder

Docker Image to build MongoDB and associated tools for Alpine Edge from aports/non-free
Dockerfile
2
star
100

nixos-config

NixOS configurations
Nix
1
star