Installing MariaDB and phpMyAdmin on Docker Desktop for Windows

Anu Wat
4 min readAug 7, 2020


In this post, I will show you how to install MariaDB and phpMyAdmin using Docker Desktop on Windows 10 Home.


When you use more than one database on your computer, you often have problems with your environment settings such as TCP/IP port collision. If you want to use multiple databases (e.g. MySQL, MariaDB) or want to install specific versions of MariaDB (e.g. MariaDB 10.1, 10.2, 10.3), you need to change the ports to 3306, 3307, 3308, … for each database.

Docker can help you manage databases on your Windows-based computer. You can install databases on a Linux environment (most real-world servers are running on Linux), and you can use Linux tools to help you tune performances of your databases via WSL2 (Windows Subsystem for Linux 2). Instructions for installing performance tuning is coming in my next post!

Docker Desktop in this article runs on Windows 10 Home. Now with Windows version 2004, you can run Docker Desktop on Windows 10 Home using WSL2 (windows subsystem for Linux 2) environment.


Step 1: Pull MariaDB and phpMyAdmin images from docker hub

Docker hub has MariaDB images for installation. The command to install is shown as “docker pull MariaDB
Docker hub has phpMyAdmin images for installation. The command to install is shown as “docker pull phpmyadmin/phpmyadmin”

Run this command to pull MariaDB docker image from docker hub.

$ docker pull mariadb

Run this command to check if you successfully pull the MariaDB image.

$ docker image
If you successfully pull the MariaDB image, you will see MariaDB in the list when you run the “docker image” command.

Run this command to pull phpmyadmin docker image from docker hub. After it finishes, you can check if the phpmyadmin image is successfully pulled using the previous command “docker image”.

$ docker pull phpmyadmin/phpmyadmin

Step 2: Create a MariaDB container.

Run the following command to create and start a container. Note that the parameter “-p (localPort: containerPort)” is important in this process. You can choose a specific local port but not the container port, because most software such as MySQL, MariaDB set default ports (3306) in environment settings. If you set the container other than the default port (3306), you can’t use MySQL. (You need to change the config in my.cnf file in a Docker container if you want to use another port.)

docker run --name=[container_name] -e MYSQL_ROOT_PASSWORD=[yourpassword] -e MYSQL_DATABASE=[database_name] -p 3306:3306 -d mariadb

for example

docker run --name=mariadb -e MYSQL_ROOT_PASSWORD=a3b6c9 -e MYSQL_DATABASE=testdatabase -p 3306:3306 -d mariadb

This example sets root’s password as “a3b6c9”, which you will need to remember for the next step.

If you get the following error :

Error response from daemon: driver failed programming external connectivity on endpoint mariadb01 (f7947a60db22243968284c8e7b68272816f462993240da78c2f8d849a6e1dc7c): Bind for failed: port is already allocated.”

make sure that port 3306 on your local computer is not already used. If the port is already used, you can change the port on your local computer that will be used to connect to the container and stop that port in services.msc (Windows key + R) and start MariaDB container again.

If you successfully create the MariaDB container, you will see this, which means that you can now use MariaDB on docker and it’s running on port 3306.

docker desktop (use docker desktop dashboard)
$ docker ps (use docker CLI)

Step 3: Test that you can connect to MariaDB.

Now, to test that you can use the MariaDB, we will test by connecting to a database management tool. In this example, I use DBeaver (a database management tool). You can install DBeaver by going to

Setting parameters in DBeaver to connect to MariaDB. In step 2, when creating a MariaDB container, I set the root password as “a3b6c9”, and port 3306. In the DBeaver connection setting, I will use the “root” username and password “a3b6c9” on server host: localhost and port: 3306
The connection status shows a green checkmark which means that it works.

Now You can use MariaDB (Enjoy ! with SELECT * FROM …………..)

Step 4: Create a PhpMyAdmin Container

Another popular database management tool PhpMyAdmin. I think if you are a web developer, you would know PhpMyAdmin (IF YOU KNOW WHAT IS XAMPP).

docker run --name [container_name]-d --link [mariadb_container_name]:db -p 8080:80 phpmyadmin/phpmyadmin

for example

docker run --name phpMyAdmin -d --link mariadb:db -p 8080:80 phpmyadmin/phpmyadmin

check container is running

docker desktop (use docker desktop dashboard)

go to: http://localhost:8080/

it works!

Now, you can use phpMyAdmin that is connected with MariaDB.

If you want to install other databases or a specific version you just pull images and create a container. I think if you use Docker it is easy to manage databases on your computer because it’s like one program per one container (database) that can easily install.

In the next part, I will show you to use some tools to help you tune the performance of your database.

Thanks for reading!

- Anu Wat -



More from Anu Wat