Working With MariaDB using Docker
[Database, MySQL, MariaDB]
Thanks to the power and flexibility of Docker, it is pretty trivial to spin up a MariaDB database instance for development and experimentation.
The most current version, as I write this, is 12.2.2.

The simplest way is to use a docker-compose.yaml file.
Below is a simple file that spins up an instance that will always restart unless you explicitly shut it down.
services:
mariadb:
image: mariadb:latest
container_name: mariadb
restart: always
environment:
MARIADB_ROOT_PASSWORD: mystrongpassword123
MYSQL_DATABASE: testdb
The container should be up and running once you spin this up.

Once you shut down this instance, its data is lost.
If you want to persist the data, do it like this:
First, decide on a location in your file system where you want the persistent data to remain.
Mine is here - /Users/rad/Docker/containers/MariaDB
We can update our Docker Compose file as follows:
services:
mariadb:
image: mariadb:latest
container_name: mariadb
restart: always
environment:
MARIADB_ROOT_PASSWORD: mystrongpassword123
MARIADB_DATABASE: testdb
volumes:
- /Users/rad/Docker/containers/MariaDB:/var/lib/mysql
As a habit, it is good to be explicit about the timezone.
Our final file looks like this:
services:
mariadb:
image: mariadb:latest
container_name: mariadb
restart: always
environment:
MARIADB_ROOT_PASSWORD: mystrongpassword123
TZ: Africa/Nairobi
MARIADB_DATABASE: testdb
ports:
- "3307:3306"
volumes:
- /Users/rad/Docker/containers/MariaDB:/var/lib/mysql
Here, I am binding the host to port 3307 as I am already using 3306 for a MySQL container.
Using your favourite tool of choice, you can verify that everything is working as expected.

You can then query to verify all is well.

My tool of choice here is JetBrains DataGrip, but you can use anything else, such as MySQL Workbench.
Of note, MariaDB is a close relative of MySQL, and much of what works for MySQL will work for MariaDB.
TLDR
Dockerized MariaDB is very straightforward to set up.
The code is in my GitHub.
Happy hacking!