DevContainers
VS Code DevContainer integration for development
DAMP creates a VS Code DevContainer setup for every project. The development environment runs inside Docker containers.
Project Structure
DAMP generates these files:
DevContainer Configuration
devcontainer.json
{
"name": "myproject",
"workspaceMount": "source=damp_project_myproject,target=/var/www/html,type=volume",
"workspaceFolder": "/var/www/html",
"build": {
"dockerfile": "../Dockerfile",
"context": "..",
"target": "development",
"args": {
"USER_ID": "${localEnv:UID:1000}",
"GROUP_ID": "${localEnv:GID:1000}"
}
},
"remoteUser": "www-data",
"runArgs": [
"--network=damp-network",
"--label=com.pickleboxer.damp.managed=true",
"--label=com.pickleboxer.damp.type=project-container"
],
"forwardPorts": [8443],
"customizations": {
"vscode": {
"extensions": [
"xdebug.php-debug",
"bmewburn.vscode-intelephense-client",
"streetsidesoftware.code-spell-checker"
]
}
},
"postCreateCommand": "[ -f composer.json ] && composer install || true; [ -f package.json ] && npm install && npm run build || true"
}Key Settings:
- Network:
damp-network(connects to Caddy reverse proxy and services) - Volume: Named Docker volume
damp_project_{name} - User: Runs as
www-data(UID/GID: 1000) - Port: Forwards port 8443 (HTTPS)
- Labels: Docker labels for DAMP management
Docker Configuration
Dockerfile
DAMP uses a multi-stage Dockerfile:
Base Image: serversideup/php:{version}-{variant}
Stages:
- base - Base PHP image with required extensions
- development - Adds Xdebug, git, zsh, Oh My Zsh
- production - Production-optimized build
PHP Variants:
fpm-apache- Apache with PHP-FPMfpm-nginx- Nginx with PHP-FPMfrankenphp- FrankenPHP serverfpm- PHP-FPM only
Development Tools:
- Git
- Zsh with Oh My Zsh
- Xdebug (mode: develop,debug,trace,coverage,profile)
- Node.js (optional: versions 20, 22, 24, 25, lts, latest)
Xdebug Configuration
xdebug.mode = develop,debug,trace,coverage,profile
xdebug.start_with_request = trigger
xdebug.client_port = 9003Docker Volumes
DAMP uses named Docker volumes:
Volume Pattern: damp_project_{projectName}
Configuration:
{
"workspaceMount": "source=damp_project_myproject,target=/var/www/html,type=volume",
"workspaceFolder": "/var/www/html"
}Volume Labels:
com.pickleboxer.damp.managed=truecom.pickleboxer.damp.type=project-volumecom.pickleboxer.damp.project-id={UUID}
Named volumes provide faster I/O on Windows compared to bind mounts.
PHP Extensions
Pre-installed Extensions
Always Included:
- ctype, curl, dom, fileinfo, filter, hash, mbstring, openssl, pcre, session, tokenizer
- xml, opcache, mysqli, pcntl, pdo_mysql, pdo_pgsql, redis, zip
- xdebug
User-Selectable Extensions:
- bcmath, gd, intl, memcached, imagick, soap, xsl, apcu, sodium, exif, ldap, pgsql
Extensions are installed using install-php-extensions script.
Network Architecture
┌────────────────────────────────────────┐
│ Docker Network: damp-network │
├────────────────────────────────────────┤
│ │
│ ┌──────────────────────┐ │
│ │ Caddy Reverse Proxy │ │
│ │ (damp-caddy) │ │
│ └──────────┬───────────┘ │
│ │ │
│ │ Routes to containers │
│ ↓ │
│ ┌──────────────────────┐ │
│ │ Project Container │ │
│ │ PHP + Apache/Nginx │ │
│ │ Port: 8443 (HTTPS) │ │
│ └──────────┬───────────┘ │
│ │ │
│ │ Connects to services │
│ ↓ │
│ ┌──────────────────────┐ │
│ │ MySQL / PostgreSQL │ │
│ │ (damp-mysql) │ │
│ └──────────────────────┘ │
│ │
└────────────────────────────────────────┘Container Discovery: DAMP identifies containers using Docker labels, not container names.
VS Code Integration
Opening in DevContainer
- Open project folder in VS Code
- Click "Reopen in Container" notification
- VS Code builds and attaches to container
- Container runs as www-data user
Debugging
Press F5 to start debugging:
{
"type": "php",
"request": "launch",
"name": "Listen for Xdebug",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}"
}
}Set breakpoints in VS Code - Xdebug connects automatically.
Post-Create Command
Runs once after container creation:
[ -f composer.json ] && composer install || true;
[ -f package.json ] && npm install && npm run build || trueBehavior:
- Installs Composer dependencies if
composer.jsonexists - Installs npm dependencies and runs build if
package.jsonexists - Non-blocking - failures don't stop container creation
Customization
Add PHP Extensions
Edit Dockerfile to add extensions via install-php-extensions.
Change PHP Version
Edit Dockerfile ARG PHP_VERSION value (7.4, 8.1, 8.2, 8.3, 8.4).
Add VS Code Extensions
Edit devcontainer.json:
{
"customizations": {
"vscode": {
"extensions": ["bmewburn.vscode-intelephense-client", "xdebug.php-debug"]
}
}
}Rebuild Container
After configuration changes:
- Press
Ctrl+Shift+Pin VS Code - Run "Dev Containers: Rebuild Container"