Minimal MariaDB + phpMyAdmin docker-compose setup

This is a minimal docker-compose.yml file to set up a MariaDB database and phpMyAdmin.

Create a .env with MARIA_DB_PASSWORD and MARIA_DB_ROOT_PASSWORD:

echo MARIADB_ROOT_PASSWORD=$(pwgen 30) > .env
echo MARIADB_PASSWORD=$(pwgen 30) >> .env

Now create a docker-compose.yml file with the following content:

services:
  mariadb:
    image: mariadb:latest
    environment:
      - MARIADB_DATABASE=wordpress
      - MARIADB_USER=wordpress
      - MARIADB_PASSWORD=${MARIADB_PASSWORD}
      - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
    volumes:
      - ./mariadb_data:/var/lib/mysql
    command: --default-storage-engine innodb
    ports:
      - 3306:3306
    restart: unless-stopped
    healthcheck:
      test: mysqladmin -p${MARIADB_ROOT_PASSWORD} ping -h localhost
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3
    
  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    depends_on:
      - mariadb
    environment:
      PMA_HOST: mariadb
    ports:
      - 17035:80

Run it using docker-compose up -d. phpMyAdmin will be available at http://localhost:17035/. In this configuration, MariaDB will be available at localhost:3306.