Install Docker Mariadb and its Dashboard

MariaDB or MySql is very popular relational database. You can easily test it out with adminer as its dashboard. To deploy MariaDB on Docker along with its Dashboard, follow these steps:


1. Install Docker

Ensure Docker is installed and running on your system:


2. Pull the MariaDB Docker Image

Pull the official MariaDB Docker image:

docker pull mariadb

3. Create a Docker Network

To ensure the containers (MariaDB and Workbench) can communicate, create a custom Docker network:

docker network create mariadb-network

4. Run MariaDB in a Docker Container

Run MariaDB with the following command:

docker run -d \
  --name mariadb \
  --network mariadb-network \
  -e MARIADB_ROOT_PASSWORD=rootpassword \
  -e MARIADB_DATABASE=testdb \
  -e MARIADB_USER=testuser \
  -e MARIADB_PASSWORD=testpassword \
  -p 3306:3306 \
  mariadb
  • Replace rootpassword, testdb, testuser, and testpassword with your desired values.
  • -p 3306:3306: Exposes MariaDB on port 3306.

 

5. Optional: Persistent Data for MariaDB

To persist MariaDB data, mount a volume:

docker run -d \
  --name mariadb \
  --network mariadb-network \
  -e MARIADB_ROOT_PASSWORD=rootpassword \
  -e MARIADB_DATABASE=testdb \
  -e MARIADB_USER=testuser \
  -e MARIADB_PASSWORD=testpassword \
  -p 3306:3306 \
  -v mariadb_data:/var/lib/mysql \
  mariadb

This stores MariaDB data in the mariadb_data volume. Change the path based on what you need.


6: Use Adminer (Web-Based UI)

Adminer is a lightweight database management tool available as a Docker image.

Step 1: Deploy Adminer

Run Adminer on the same Docker network:

docker run -d \
  --name adminer \
  --network mariadb-network \
  -p 8080:8080 \
  adminer

Step 2: Access Adminer

  1. Open adminer on your browser http://localhost:8080.
  2. Log in to MariaDB using:
    • System: MySQL
    • Server: mariadb (container name)
    • Username: testuser
    • Password: testpassword