Installing WordPress and phpMyAdmin with Docker Compose
🧠 Technical Summary (Analysis)
This guide explains how to install WordPress with Docker Compose.
The goal is to create a container-based and portable WordPress environment.
WordPress, MariaDB and phpMyAdmin are managed with a single YAML file.
What Will You Learn in This Guide?
In this guide, you will install WordPress using Docker Compose.
You will add the MariaDB database and phpMyAdmin administration panel.
You will ensure data permanence with the volumes structure.
Prerequisites
- An Ubuntu based server
- Docker and Docker Compose must be installed
- User with sudo privilege
1. Step – Preparing the Project Directory
This command creates a working directory for WordPress.
mkdir ~/wordpress && cd ~/wordpress
2. Step – Creating the Docker Compose File
This file defines all services.
nano docker-compose.yml
- File content:
version: "3"
services:
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: guclu_bir_sifre
volumes:
- db_data:/var/lib/mysql
restart: always
wordpress:
image: wordpress
depends_on:
- db
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: guclu_bir_sifre
volumes:
- ./wp_content:/var/www/html
restart: always
phpmyadmin:
image: phpmyadmin/phpmyadmin
depends_on:
- db
ports:
- "8181:80"
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: guclu_bir_sifre
restart: always
volumes:
db_data:
Note: Be sure to change strong_password fields.
3. Step – Starting Services
- This command runs all services in the background.
docker-compose up -d
Docker images automatically download and launch them.
4. Step – Testing the Installation
Access addresses from browser:
- WordPress:
http://sunucu-ip:8080
- phpMyAdmin:
http://sunucu-ip:8181
- phpMyAdmin login information:
-
User: root
-
Password: the password you set
5. Step – Data Persistence (Volumes)
-
This structure prevents data loss:
-
db_data: Database is persistent
-
wp_content: Theme and plugins are stored on the server
-
Data is preserved even if the container is deleted.
Frequently Asked Questions (FAQ)
1. Why should I use Docker Compose? It allows managing all services with a single file.
2. Can I change the 8080 port to 80? Yes, you can write 80:80 instead of 8080:80.
3. I'm getting a database connection error, why? The database may not be ready yet. Wait a few seconds.
4. Is phpMyAdmin mandatory? No, but it makes management easier.
5. Can this structure be used in the prod environment? Yes, SSL and security should be added.
Result
WordPress installation is completed with Docker Compose. All services are managed from a single file. The installation is portable and easy to maintain.
👉 You can launch WordPress in minutes with Docker compatible servers on the GenixNode platform.

