dev-container.md 3.6 KB

Persistent development container

Run tools/dev-container.sh on the authorized Linux Podman host as root. The default task container is prod2u-dev. Source editing remains on Windows; /workspace receives an exact committed Linux build snapshot.

tools/dev-container.sh --help
tools/dev-container.sh --workspace /data/prod2u/build-snapshots/SNAPSHOT up
tools/dev-container.sh doctor
tools/dev-container.sh run --workdir /workspace -- python3 -m pytest tests/unit/test_dev_container.py
tools/dev-container.sh stop
tools/dev-container.sh up
tools/dev-container.sh checkpoint
tools/dev-container.sh down
tools/dev-container.sh up
tools/dev-container.sh --workspace /data/prod2u/build-snapshots/NEW-SNAPSHOT recreate
tools/dev-container.sh status

up reuses or starts the same container. An existing workspace mount cannot be silently changed by run; use explicit recreate. stop preserves the writable layer. down first stops and commits that layer to a uniquely named checkpoint image, saves its immutable image ID, then removes the container. Subsequent up uses that ID. recreate checkpoints first and probes the replacement before removing the original. Failed replacement creation/probing restores the original container. Old checkpoint images remain available for recovery.

The container runs UID/GID 0 with privileged mode and host networking. Existing binds and process namespace settings are retained; cache/state/data/TD remain under /data/prod2u. Mounting an entire empty system directory over /usr, /usr/local, /opt, /root, /etc, or /var/lib/dpkg is rejected. No new OS user or host PATH changes are needed. TD vendor library variables stay in tools/td2026.

Lifecycle changes and image builds share /data/prod2u/cache/heavy.lock with verification jobs. run holds a shared lifecycle lock until its command ends. An active Podman exec or background process in the container cgroup prevents stop/checkpoint/removal. Direct unmanaged Podman commands do not participate in the shared lock: do not start them concurrently with lifecycle changes.

State is stored at /data/prod2u/state/dev-container/prod2u-dev.json by default (or under host XDG_STATE_HOME/--state-dir). status distinguishes the actual container environment ID from the saved checkpoint environment/image ID. A checkpoint does not contain bind data: preserve those host directories separately. Uncheckpointed installs are not recoverable after arbitrary podman rm -f, loss of the checkpoint image, or disk failure.

build forwards the existing containers/6400-dev/build-image.sh; it builds the initial image and does not replace a running container or its checkpoint. Use --help on that entrypoint for build configuration. The legacy run.sh forwards to this lifecycle implementation and no longer uses --rm or --network=none.

Functional persistence was exercised on source 0c8702d1cbe8ee0b74ccc98e742665866aa5614b in /data/prod2u/runs/container-0c8702d/RESULT.json: an executable installed in /usr/local/bin, cache and bind markers survived stop/up, checkpointed down/up, and recreate. Busy-stop rejection and Icarus compile/run before and after passed. This is container evidence, not product TD or physical hardware acceptance.

doctor compiles and runs the same counter with Icarus and Verilator. The initial image explicitly installs make and g++, required by Verilator's generated C++ build. Merely finding the Verilator executable does not establish that this path works. The TD smoke uses tools/verify_td_smoke.py separately and retains native synthesis, placement, timing and bitgen reports.