Setting up main database

This docker-compose will setup MariaDB and Adminer a web interface for ease of use when handling MariaDB

version: "3.8"
services:
  db:
    container_name: mariadb
    image: 'mariadb:latest'
    env_file: ./.env
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: '${MYSQL_ROOT_PASSWORD}'
      TZ: America/New_York
    volumes:
      - '${HOME}/docker-data/mariadb/data:/var/lib/mysql'
      - ./conf:/etc/mysql
    command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
    restart: unless-stopped

  adminer:
    container_name: adminer
    image: 'adminer:latest'
    ports:
      - "8080:8080"
    restart: unless-stopped
    depends_on:
    - db

networks:
  default:
    name: networkname
    external: true

To access the container you can do docker exec -it mariadb /bin/bash then you can enter mysql db directly using mysql -u root -p

You can see more in depth commands for database/user creation here: MariaDB/MYSQL