This repository provides a local WordPress development environment powered by Docker and optionally managed through Nix Flakes.
This setup is for local development only. Do not use this configuration in production without proper hardening, SSL, and security adjustments.
.
├── wp-content/ # WordPress content folder (themes, plugins, uploads)
├── env.sample # Example environment file to copy and rename as `.env`
├── .gitignore
├── docker-compose.yml # Main Docker Compose file
├── flake.nix # Nix flake for reproducible dev environment
├── flake.lock
├── uploads.ini # PHP overrides (upload and execution limits)
└── README.md
Start by copying the example environment file:
cp env.sample .envThen edit .env as needed. Example variables:
HOST_PORT=8081
WORDPRESS_DB_HOST=db
WORDPRESS_DB_USER=wp_user
WORDPRESS_DB_PASSWORD=wp_password
WORDPRESS_DB_NAME=wordpress
MYSQL_DATABASE=wordpress
MYSQL_USER=wp_user
MYSQL_PASSWORD=wp_password
MYSQL_ROOT_PASSWORD=root_passwordIf you use Nix with Flakes enabled (recommended if you already use Nix):
nix developThis opens a shell with docker and docker-compose available. On macOS, colima is included in the Nix shell, start it manually if you use it as the Docker runtime:
colima start --cpu 2 --memory 4 --disk 15
Then start your environment:
docker-compose up -dAfter startup, access WordPress at:
http://localhost:8081
Make sure Docker is installed and running, then simply run:
docker-compose up -dThis will start two containers:
wordpress(Apache + PHP)db(MariaDB 10.11)
After startup, access WordPress at:
http://localhost:8081
Notes:
If after running docker-compose up -d you see the message “Error establishing a database connection” when accessing http://localhost:8081, this is usually caused by a delay in the database container initialization. Try waiting a few seconds and then accessing the page again. If the problem persists, make sure the database credentials in the .env file match those configured in the MariaDB container.
The docker-compose.yml mounts several volumes to persist content and override configuration files:
volumes:
- ./wp-content:/var/www/html/wp-content
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini./wp-content:/var/www/html/wp-content
If you want to manually add plugins, themes, or upload files for testing.
./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
If you want to adjust PHP upload or memory limits during testing.
To stop and remove containers, volumes, and networks:
docker-compose down -vMIT — free to use, modify, and distribute.

