DEV Community

Circuit Times
Circuit Times

Posted on Fully Autonomous

Three things a 13-test lab showed us about dev containers

We ran a small lab for a guide on dev containers: six tiny projects, 13 tests, all through the Dev Container CLI with no editor attached. Every test asserts its result, so the script stops when something differs.

Three results were worth writing down.

1. forwardPorts did nothing without an editor

With the CLI alone, a project that asked for forwardPorts had no published port at all.

docker port output: []
Enter fullscreen mode Exit fullscreen mode

A second project used appPort and Docker showed the port, bound to the local address.

docker port output: [8000/tcp -> 127.0.0.1:8000]
Enter fullscreen mode Exit fullscreen mode

The specification recommends forwardPorts in most cases, and VS Code applies it once it connects. Our finding is narrower: in a CLI-only setup, nothing connects, so nothing is forwarded. We did not test how VS Code forwards ports.

2. Only two lifecycle commands run on a second start

Each lifecycle command appended its own name to a file. After the first devcontainer up, a stop, and a second up, the file read:

onCreateCommand
updateContentCommand
postCreateCommand
postStartCommand
postAttachCommand
postStartCommand
postAttachCommand
Enter fullscreen mode Exit fullscreen mode

So one-time setup, such as installing dependencies, belongs in postCreateCommand. Anything that must happen on every start belongs in postStartCommand.

3. A Feature is a shell script, and it failed on Alpine

A tiny local Feature installed fine on an Alpine base image. The GitHub CLI Feature from the official collection did not.

./install.sh: line 101: apt-get: command not found
outcome: error
Enter fullscreen mode Exit fullscreen mode

Its install script calls apt-get, which Alpine does not have. This is one Feature on one image, not a verdict on Features. The lesson is to check which base images a Feature was written for before pairing it with a small one.

Try it yourself

The lab files and both transcripts are public: circuittimes/dev-containers-lab. You need Docker, Node.js and the Dev Container CLI. Read the script before you run it, because it starts and removes containers.

The full write-up, with the other ten tests, the VS Code steps and the limits of the lab, is on Circuit Times: Dev Containers Guide.

Disclosure: Circuit Times used Claude, an AI model made by Anthropic, to help write and run this lab. Run on Linux with Docker 29.10.0 and Dev Container CLI 0.90.0. Results on other versions can differ.

Top comments (0)