Preconfigured Docker Dev Environment
Chisel ships with a fully preconfigured Dev Container setup that lets you start coding immediately without installing PHP, MySQL, or Apache locally. Everything runs in isolated Docker containers, ensuring a consistent environment across your team.
Overview
The setup uses VS Code Dev Containers to spin up a complete WordPress environment.
| Service | Technology | Details |
|---|---|---|
| Web Server | Apache | Running on custom port (default 3000) |
| PHP | PHP 8.3 | Based on official wordpress:6.9.0-php8.3 image |
| Database | MariaDB 11.4 | Persistent volume for data |
| Node.js | Node 20 | For frontend build tools |
| Tools | WP-CLI, Composer, Git | Pre-installed and configured |
Getting Started
Prerequisites
- Docker Desktop installed and running.
- VS Code installed.
- Dev Containers extension for VS Code.
Installation
To create a new project with the Dev Container pre-configured:
npx -y generator-chisel --devcontainerBashStarting the environment
- Open your project folder in VS Code.
- You should see a prompt: “Folder contains a Dev Container configuration file. Reopen to develop in a container.”
- Click Reopen in Container.
Alternatively: Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run “Dev Containers: Reopen in Container”. VS Code will build the images and start the containers. This may take a few minutes the first time.
Automatic Configuration
Once the container starts, the post-create-command.sh script automatically runs to:
- Install dependencies: Runs
npm installandcomposer install. - Configure WordPress: Generates wp-config-local.php with correct database credentials for the container network.
- Build assets: Runs
npm run build. - Fix permissions: Ensures file ownership is correct for the
wordpressuser.
VS Code Integration
The environment comes with pre-configured VS Code extensions and settings (.devcontainer/devcontainer.json), including:
- ESLint & Prettier for code quality.
- Stylelint for SCSS.
- PHP Intelephense for autocompletion.
- EditorConfig for consistent formatting.
Usage
Local Server
Your site will be available at: http://localhost:3000 (or the port defined in CHISEL_PORT)
Terminal
The integrated terminal in VS Code runs inside the container. You can run all commands directly:
# Run WP-CLI commands
wp plugin list
# Run Composer
composer install
# Run NPM scripts
npm run devBashDatabase Access
- Host:
db - User:
mariadb - Password:
mariadb - Database:
mariadb
Configuration & Debugging
Editing wp-config.php
In the Docker environment, wp-config.php automatically loads wp-config-local.php if it exists. This file is generated by Chisel but can be edited directly to change settings.
To enable debug logs or other constants:
- Open
wp-config-local.php. - Modify the constants as needed.
Example for full debugging:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false ); // Hide errors from screen, log them instead
// Required for Chisel's fast refresh functionality
define( 'SCRIPT_DEBUG', true );
define( 'WP_ENVIRONMENT_TYPE', 'development' );PHPNote: If you accidentally delete or break this file, you can regenerate it with the correct Docker database credentials by running:
npm run wp-config -- --devcontainerBashChanging PHP/WP Version
Edit .devcontainer/docker-compose.yml:
args:
BASE_IMAGE_VERSION: 6.9.0-php8.3 # Change to desired versionYAMLChanging Port
Edit .devcontainer/docker-compose.yml and .devcontainer/Dockerfile.
Node Modules & Vendor
node_modules and vendor directories are mounted as named volumes to improve performance and prevent permission issues between the host OS and the container.