MariaDB with Docker Compose
MariaDB with a health check, reachable from the host only. The services are ticked below: set your project name and port, then copy compose.yaml and .env.
- Free
- No Sign-Up
- Runs in Your Browser
Services
NoteReplace every change-me in .env with a long random password (openssl rand -base64 24) before the first start: databases keep the first password they are given.
NoteDatabase ports are bound to 127.0.0.1, so only this server can reach them. Never publish them on all addresses: Docker's ports bypass UFW.
compose.yaml
# compose.yaml, generated at frabs.net/tools/docker-compose-generator/
services:
mariadb:
image: mariadb:11
restart: unless-stopped
ports:
- "127.0.0.1:3306:3306"
environment:
MARIADB_DATABASE: wordpress
MARIADB_USER: wordpress
MARIADB_PASSWORD: ${DB_PASSWORD}
MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
volumes:
- mariadb:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
retries: 5
volumes:
mariadb:
.env
# .env (keep out of version control) DB_PASSWORD=change-me DB_ROOT_PASSWORD=change-me-too
Start It
docker compose up -d && docker compose ps
Docker Compose Generator
What you get
Servicesmariadb
ImagesPinned to a major version
DataNamed volumes
Secrets.env file
DatabasesNot published to the internet
MariaDB with a health check, reachable from the host only.
Start it with docker compose up -d; update later with docker compose pull && docker compose up -d.
Questions
How do I run MariaDB with Docker Compose?
Save compose.yaml and .env in an empty folder, set real passwords in .env, then run docker compose up -d.
Free Tools
More tools
Docker Compose GeneratorStarter compose.yaml files for common stacks, with safe defaults.Nginx Config GeneratorServer blocks for reverse proxies, static sites and PHP, with HTTPS.VPS RAM CalculatorHow much memory a server needs for its OS, apps, databases and caches.Linux Command GeneratorReady-to-run commands for disks, networking, services, logs and diagnostics.
Run VMs for other people?
Frabs stops spam, scans and floods leaving your customers' VMs, before the abuse report lands.