Docker - MariaDB Container Setup
Here I describe my setup of the Docker MariaDB container. MariaDB is a fork of the MySQL database. I use this database, among other things, to store data from Home Assistant. Furthermore, it is very easy to connect MariaDB to Grafana to visualize data.
The setup of my NixOS Podman MariaDB container is described here.
Docker pull command:
docker pull mariadb
Within my home folder I have created a Docker folder where I create a subfolder for each container:
cd ~ mkdir -p docker/mariadb cd docker/mariadb
Also create folders where the MariaDB data and config files can be stored:
mkdir data mkdir config
I use the Nano text editor to create a shell script:
sudo nano mariadb_run.sh
With this shell script we are going to create the container.
Copy the following into
docker run -d \ --hostname=mariadb \ --name=mariadb \ --net=host \ -v $PWD/config:/etc/mysql/conf.d \ -v $PWD/data:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD=PASSWD \ -e TZ="Europe/Amsterdam" \ --restart=unless-stopped \ mariadb
If necessary, adjust the following:
Choose the location for the MariaDB config. In this example it is the config map we created
Choose the location for the MariaDB data. In this example it is the data map we created
Replace PASSWD with your own password
Pick the right timezone
Exit Nano (CTRL-X) and save the changes.
Now create the container:
sudo sh mariadb_run.sh
Check if the container is running properly.
To handle the administration of MariaDB I personally use phpMyAdmin.
Here I describe how you can make daily backups of MariaDB databases
Read other notes
No comments found for this note.
Join the discussion for this note on this ticket. Comments appear on this page instantly.
Notes mentioning this note
- Docker - Home Assistant Container Setup with MariaDB and InfluxDB 2.x
Here I describe my setup of the Home Assistant container with MariaDB and InfluxDB 2.x.
- Home Assistant - Setup MariaDB Database Size Sensor
Here I describe how to create a sensor for Home Assistant that will monitor the size of the MariaDB database...
- Docker - Grafana Container Setup
Here I describe my setup of the Docker Grafana container. With Grafana you can create beautiful dashboards.
- Docker - QuestDB Container Setup
QuestDB is a high-performance, open-source SQL database. QuestDB’s stack is engineered from scratch, zero-GC Java and dependency-free. It includes endpoints...
- MariaDB - NixOS Container Setup
MariaDB is a fork of the MySQL database. I use this database, among other things, to store data from [[Docker...