A complete WordPress Docker development environment that works with any IDE or editor. This setup provides concurrent theme and plugin development with centralized configuration, automatic WordPress installation, and all the tools you need for modern WordPress development.
- 🔄 Concurrent Development: Develop both themes and plugins simultaneously with volume mounting
- ⚙️ Centralized Configuration: All settings managed through
.devcontainer/.envfile - 🛠️ Makefile Commands: Simple commands for all common development tasks
- 🐳 Docker-First: Works with any IDE - VS Code, PhpStorm, Sublime Text, Vim, etc.
- 🔧 Pre-configured Tools: WP-CLI, Composer, Node.js 20 with pnpm, Xdebug 3
- 📧 Email Testing: Mailhog integration for testing WordPress emails
- 🗄️ Database Management: MariaDB with automatic WordPress installation
- 🔍 Debugging Ready: Xdebug configured for both VS Code and other IDEs
- Docker and Docker Compose
- VS Code with Dev Containers extension (optional, for enhanced experience)
- Make (optional, for convenient commands)
- Create your repository from this template on GitHub (Use this template)
- Clone your new repository:
git clone https://github.com/<you>/<your-repo>.git cd <your-repo>
- Open in VS Code:
code . - Reopen in Container when prompted, or use
Ctrl+Shift+P→ "Dev Containers: Reopen in Container" - WordPress will be available at http://localhost:8080
- Initialize and start:
make setup make up
- Access WordPress at http://localhost:8080
- Edit files in
src/themes/my-theme/andsrc/plugins/my-plugin/ - Shell into the container when needed:
make shell
git clone https://github.com/<template-owner>/<template-repo>.git
cd <template-repo>All development settings are centralized in .devcontainer/.env. To get
started:
- Run
make setupto create.devcontainer/.envfrom the example file - Customize any values in
.devcontainer/.envas needed
Key configuration options:
- Database:
WORDPRESS_DB_*variables for database connection - WordPress:
WP_*variables for WordPress core settings - Development:
THEME_SLUG,PLUGIN_SLUGfor your theme/plugin names - WP-CLI Setup:
SITE_TITLE,ADMIN_*for initial WordPress installation - Ports:
WP_PORT,MAILHOG_PORTfor service ports
The .env file is gitignored, so your local customizations won't be committed.
# Show all available commands
make help
# First time setup
make setup
# Start development environment
make up
# View logs
make logs
# Access WordPress shell
make shell
# Run WP-CLI commands
make wp cmd="plugin list"
# Stop environment
make down
# Clean everything (removes volumes)
make clean- Open the project in VS Code and Reopen in Container
- Ensure the Docker container is running (
make up) - Use the preconfigured launch: Run and Debug → "Listen for Xdebug (Docker)"
- Set breakpoints in your theme under
wp-content/themes/my-themeor plugin underwp-content/plugins/my-plugin
- Start the environment:
make up - Configure your IDE to connect to Xdebug:
- Host:
localhost - Port:
9003 - Path mapping: Local
src/→ Container/var/www/html/wp-content/
- Host:
- Set breakpoints in your local
src/files - Start debugging session in your IDE
- Mailhog UI: http://localhost:8025
- PHP mail() is routed to Mailhog via mhsendmail; no extra config needed
Any .sql files placed in .devcontainer/data will be automatically imported
when your site is built (using wp db import). Ensure table name prefixes match
(default is wp_).
Anything placed in the .devcontainer/data/plugins folder (single files or
folders) will be copied into the WordPress plugins folder and activated as a
plugin. This enables things like defining custom post types relevant to your
imported data set.
- PHP 8.2 with Xdebug 3 (port 9003)
- Node.js 20 with pnpm via corepack
- MariaDB 10.11
- WordPress (latest)
Container won't start:
make down
make upWordPress not accessible:
- Check if containers are running:
make ps - Check logs:
make logs - Verify port 8080 is not in use
Xdebug not working:
- Ensure port 9003 is not blocked
- Check IDE Xdebug configuration
- Verify path mappings are correct
File changes not reflecting:
- Check volume mounts in
docker-compose.yml - Restart container:
make restart
Database connection issues:
- Wait for database to be ready:
make logs-db - Check database credentials in
.env
We welcome contributions! Here's how you can help:
- Check existing issues first to avoid duplicates
- Use the issue templates when creating new issues
- Provide detailed information:
- Your operating system
- Docker version
- Steps to reproduce
- Expected vs actual behavior
- Relevant logs (
make logs)
Before creating a pull request, please:
- Discuss your changes by creating an issue first to get feedback
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and test them thoroughly
- Commit your changes:
git commit -m 'Add amazing feature' - Push to your branch:
git push origin feature/amazing-feature - Open a Pull Request referencing the discussion issue
You can pull future improvements from this template without overwriting your work.
- Keep all your custom code under
src/** - Configure your settings in
.devcontainer/.env(gitignored)
git remote add upstream https://github.com/supermodo/wp-devbox.git
git fetch upstream
git rebase upstream/master # or: git pull --rebase upstream masterAdd a .gitattributes rule so your local changes under src/** are kept during
merges/rebases:
src/** merge=oursEnable the merge driver once per repo:
git config merge.ours.driver trueSide effects: upstream changes under src/** will not be merged automatically;
your local src/** always wins. Review upstream diffs before rebasing if
needed.
Alternatively, keep theme/plugin as separate repositories and include them here
as Git submodules under src/ for full isolation from infra changes.
Inspired by valenvb's vscode-devcontainer-wordpress.