Dev container
Eddy doesn't need a container: the build runs on the PHP, Composer and Node.js of your machine. A dev container gives you the same environment without installing them, in GitHub Codespaces, DevPod, VS Code or any other tool that reads .devcontainer/devcontainer.json. It also keeps an AI agent that works on the extension away from your machine. This page covers turning it on, what the container has and the traps it avoids.
Turn on the dev container
The installer asks "Add a dev container", which defaults to no. With yes, the project gets .devcontainer/devcontainer.json. To add the file to a project you've already installed, ask the update skill to turn the dev container on (see Updating). The update skill keeps the file in every later update.
Eddy publishes 1 image for each PHP version that CI tests, for amd64 and arm64, with the PHP version in its name. The file names the image of the lowest PHP version that your Drupal majors support, the one the test-php-min-* jobs of .github/workflows/test.yml run. Its tag is the Eddy release that your project came from. So a Drupal 10 and 11 project installed from Eddy 5.3.0 starts ghcr.io/drevops/eddy-devcontainer-php8.3:5.3.0.
Each image has these tags:
| Tag | Image |
|---|---|
A release, such as 5.3.0 | The image that Eddy built for that release |
latest | The image of the latest release that isn't a pre-release |
canary | The image built from the latest commit on the main branch of Eddy |
A project installed from a clone of Eddy names the release that the clone names. To try the next release before it ships, put canary in .devcontainer/devcontainer.json by hand. Renovate moves a release tag to each later Eddy release with the same major version.
Start the container
Run each of these from the root of your project. The tool builds nothing: it pulls the image and starts a container from it.
| Tool | Start | Get a shell | Remove |
|---|---|---|---|
| DevPod | devpod up . --ide none | devpod ssh <name> | devpod delete <name> |
| Dev Containers CLI | npx @devcontainers/cli up --workspace-folder . | npx @devcontainers/cli exec --workspace-folder . bash | docker rm -f the container it names |
| VS Code | The Dev Containers: Reopen in Container command | Its terminal | Remove Container in the Remote Explorer |
| Codespaces | gh codespace create -R <owner>/<repository> -b <branch> | gh codespace ssh | gh codespace delete |
Codespaces builds the container from the branch on GitHub, so commit and push .devcontainer/devcontainer.json to that branch first.
Once the container starts, it runs scripts/eddy-tooling, so the tooling commands are ready. Then build the site as you would on your machine:
- Make
- Ahoy
- No wrapper
make build
ahoy build
vendor/bin/eddy-assemble
vendor/bin/eddy-start
vendor/bin/eddy-provision
The container has no copy of your git credentials. VS Code and Codespaces pass them in. With DevPod or the Dev Containers CLI, set up an SSH key or a credential helper in the container before you push.
What the container has
- PHP with Composer and the extensions that Drupal needs,
gd,pdo_sqliteandsodiumamong them. It also haszip, which Composer unpacks packages with. - No PHP memory limit, as in CI, so PHPStan's workers have the memory they need.
- pcov for code coverage, and Xdebug installed but off.
XDEBUG=1turns step debugging on, as it does on your machine (see Debug your extension). - Node.js 22 with npm, the version that CI runs.
- Ahoy, for a project that uses Ahoy as its command wrapper.
- Chromium and chromedriver for FunctionalJavascript tests. Chromium runs headless, since a container has no screen, and
browser-startfinds both onPATH. sqlite3, the client thatdrush sql:cliruns, andmake.cloudflared, for the public tunnel.
Before Eddy publishes an image, CI checks each of these with goss, and that Chromium answers a WebDriver session.
The image sets LC_ALL=C.UTF-8, so a locale that your tool passes in from your machine, such as en_AU.UTF-8, prints no warning.
To add a PHP extension, run sudo docker-php-ext-install with its name. An extension that links to a system library needs that library's -dev package first. The image holds no package lists, so run sudo apt-get update before sudo apt-get install. The extension lasts until the container is removed, so add both commands to the postCreateCommand of your project to keep it.
Verify the image
GitHub stores a signed build attestation for every published image. To verify the image that your project names, run this GitHub CLI command with the image and tag from .devcontainer/devcontainer.json:
gh attestation verify oci://ghcr.io/drevops/eddy-devcontainer-php8.3:5.3.0 --repo drevops/eddy
Reach the site
start picks a free port from 8000 to 8099 (see Webserver), so the file labels that whole range. VS Code and Codespaces forward each port when start listens on it, and offer to open it. To forward a port by hand, add it in their Ports view. The Dev Containers CLI forwards no ports, so with the CLI, set CLOUDFLARE_TUNNEL=1 to reach the site (see Public tunnel). The image sets WEBSERVER_HOST=127.0.0.1: localhost is ::1 in the container, and a forwarded port connects to 127.0.0.1. The login links that provision and login print then open in your own browser.
The build directory
build sits on a Docker volume rather than in your workspace, and so does the Rector cache in build/.rector. A volume is faster than a workspace that Docker Desktop shares from your machine, and file locks work on it (see Traps). assemble empties the volume in place of removing it. reset leaves the empty directory behind.
Docker creates the directory in your workspace for the volume. On a Linux machine, root owns that empty build directory outside the container, so remove it with sudo if you need to.
Traps
A container avoids 3 traps that a development environment of your own can fall into:
- A PHP without
sodium. A PHP that a version manager such as mise or asdf compiles can leave out thesodiumextension.composer requirethen fails on any package that requiresext-sodium, such aslcobucci/jwt, which Simple OAuth uses. The image hassodium. On your machine, install a PHP with it, rather than ignoring the platform requirement. flock()does nothing on a shared workspace. On a workspace that Docker Desktop shares from your machine,flock()returns at once for a second process while the first still holds the lock. Rector's parallel workers then build the same cache files at once, andlintfails with errors such asUnable to create fileorrename(...): No such file or directoryinbuild/.rector. The dev container keepsbuildon a volume, where locks work. In a container of your own, do the same.- Git reports changes in a clean tree. A workspace that Docker Desktop shares doesn't keep the file stat data that git compares, so a rebase can stop on "Your local changes would be overwritten" while
git statusis clean. The image setscore.checkStattominimalfor every repository. In a container of your own, rungit config core.checkStat minimalin the project.
A GitHub runner bind-mounts a normal Linux directory, where locks and stat data both work, so CI can't reproduce the last 2 traps.