This repository provides a minimal and functional Docker-based setup for running WordPress locally. It uses the official WordPress and MariaDB containers via Docker Compose. All content is persisted using volumes, and the setup is ready to be deployed via Docker with a custom (optional) .env configuration.
sudo apt update && sudo apt install -y docker.iowordpress/
├── docker-compose.yml
├── .env # Environment variables (manually created)
├── .gitignore
└── README.md
- Install dependencies:
sudo apt update && sudo apt install -y docker.io docker-compose git- Clone the repository:
git clone https://github.com/BenjaminTietz/wordpress-docker.git
cd wordpress-docker
- Generate and configure the .env file:
The environment file will be created automatically from template.env. Adjust the values to match your setup (optional):
cp template.env .env
nano .env (optional)- Start the project:
docker compose up -d
- Access WordPress:
Visit in your browser:
http://localhost:8080
Or, if deployed on a remote VM:
http://<your-vm>:8080
All WordPress and MySQL credentials are configured via environment variables defined in the .env file:
Example:
WORDPRESS_DB_NAME=wordpress
WORDPRESS_DB_USER=wp_user
WORDPRESS_DB_PASSWORD=wp_pass
WORDPRESS_DB_HOST=db:3306
MARIADB_ROOT_PASSWORD=rootpass
MARIADB_DATABASE=wordpress
MARIADB_USER=wp_user
MARIADB_PASSWORD=wp_pass