Link: Github Repository
Reach me out via LinkedIn, Portfolio Contact Form or mail@pascal-nehlsen.de
WordPress with MariaDB Using Docker Compose
Welcome to your WordPress and MariaDB setup! This repository provides an easy-to-use configuration for hosting a WordPress website backed by a MariaDB database using Docker Compose.
Table of Contents
Description
This repository includes a Docker Compose setup for quickly launching a WordPress instance with a MariaDB database. It simplifies the process of setting up and maintaining a WordPress site with an underlying database.
Key features:
- Containerized Deployment: Run WordPress and MariaDB reliably using Docker.
- Environment Variable Configuration: Easily customize credentials and database details via a
.envfile. - Scalable & Portable: Run locally or deploy on a remote server/VM.
Quickstart
Prerequisites
Ensure you have the following tools installed:
- Docker
- Docker Compose was included with Docker versions 20.10 and later, but recently it is no longer included by default. For the latest Docker versions, you will need to install Docker Compose manually as a plugin. Follow the official instructions for detailed steps.
-
Clone this repository:
git clone https://github.com/PascalNehlsen/wordpress-container
cd wordpress-container -
Create a
.envfile from the example configuration:cp example.env .env -
Edit the
.envfile to set your desired configuration (see Configuration). -
Start the WordPress and MariaDB containers:
docker compose up -d -
Access your WordPress site:
- Open your browser and navigate to
http://localhost:8080(or your server's IP if running remotely). - Now you can configure the Admin panel.
- Open your browser and navigate to
-
To stop the server, use:
docker compose down
Usage
Configuration
The example.env file allows you to customize the WordPress and MariaDB setup. Below is a list of the environment variables and their functions:
| Variable | Description | Possible Values | Required |
|---|---|---|---|
WORDPRESS_USER | Username for the WordPress admin account. | user | Yes |
WORDPRESS_PASSWORD | Password for the WordPress admin account. | password | Yes |
DATABASE_NAME | Name of the MariaDB database used by WordPress. | wordpress | Yes |
DATABASE_HOST | Hostname of the database (matches the db service) and db exposed Port. | db:3306 | Yes |
Updating the Setup
To modify the configuration, edit the .env file and restart the containers:
docker compose down
docker compose up -d