Skip to content

fix(devcontainer): build the devcontainer image FROM devtools #6414

Closed
4 of 4 issues completed
Closed

Description

@dan-petty

Problem

  • The DevContainer Image job averages 386 s (maximum 497 s; 13 of 18 jobs over 360 s). That is over the limit of 5 min plus 1 min (AGENTS.md rule 5), so this item is a P0 until the devcontainer builds FROM devtools. No interim fix exists: the Features rebuild because they sit on top of the src layer. Each release adds 16 layers, 1537 MiB, to GHCR.
  • .devcontainer/Dockerfile downloads and checks tools by hand: the actionlint stage, the tools stage (:8-258, 22 curl and sha256sum blocks), the npm-tools stage (:264-272) and the semgrep, bandit and ansible-core venvs (:329-350). .devcontainer/image/devcontainer.json adds 7 Features with copied version pins (29.9.3, 1.37.2, 4.3.2, 1.39.0). The image actions call devops install-tools.
  • The docker-in-docker:2 entry is frozen at 2.17.0 and does not support debian:sid (codename forky), so .devcontainer/Dockerfile:311 rewrites /etc/os-release to trixie. Its option enableNonRootDocker exists in neither 2.17.0 nor 4.1.3.
  • The GIT_CONFIG_* entries in containerEnv give 4 SecretsUsedInArgOrEnv build-check warnings, so the Dockerfile cannot use # check=error=true.

Change

Owner decisions of 2026-11-19:

  • The devcontainer image builds FROM ghcr.io/dan-petty/devtools by digest. Renovate bumps the digest.
  • Podman replaces Docker: ghcr.io/dan-petty/devcontainer-features/podman-in-podman:1 with dockerCompat: true (compose stays at its default, podman-compose; no Docker CLI, owner 2026-11-19). The docker-in-docker Feature and the /etc/os-release rewrite go.
  • minikube stays. It comes from the devtools image (mise). The podman driver is not tested, so a minikube scenario is a later item.
  1. .devcontainer/Dockerfile:
    • FROM ghcr.io/dan-petty/devtools:<tag>@sha256:<digest>.
    • A lock stage that runs uv export --locked --no-emit-project, as Dockerfile:12-23 does.
    • A venv layer at /opt/devops-cli/.venv, on PATH, installed with --require-hashes.
    • Last, COPY --link of pyproject.toml, README.md and src/, then USER vscode. Add # check=error=true.
    • Keep only the devcontainer layers (keyring config, tiktoken cache). The install -d -m 0700 -o 1000 -g 1000 /run/user/1000 at :310 can stay.
    • Delete the actionlint stage, the tools stage (:8-258), the npm and Python tool-lock COPYs (:264-272, :329-350; bandit stays in the project dev group), the os-release sed (:311) and the unpinned pre-commit install (:357). pre-commit comes from the devtools uv tool lock.
  2. .devcontainer/image/devcontainer.json:
    • Keep only common-utils:2 (user vscode, uid 1000; the devtools image has no login user) and podman-in-podman:1 with {"dockerCompat": true}. dockerCompat is needed because the Docker SDK of devops-cli needs the Podman API socket, and ci.yml:497-503, the smoke action and the Docker and Containers extensions need a docker command (podman-docker, which runs Podman).
    • Remove docker-in-docker:2, kubectl-helm-minikube, github-cli, node, copilot-cli and claude-code, and their copied version pins. Their tools come from devtools.
    • Keep containerEnv and remoteUser. Move the GIT_CONFIG_* entries to remoteEnv. This keeps their command-scope precedence and removes the 4 warnings. Test the order of the credential helpers. Do not use git config --system, which is not equivalent.
    • Make .devcontainer/image/devcontainer-lock.json again with devcontainer upgrade.
  3. Build: the image keeps two Features, so build it with the Dev Containers CLI from the official devcontainers/ci action pinned by SHA, or with the CLI of the devtools image in a job container. .github/actions/devcontainer-image/action.yml:44-49 and devcontainer-smoke/action.yml:27 stop calling devops install-tools. Keep the devcontainer-smoke checks (label, uid 1000, devops --version, docker, which now meets a Podman server), and give the step that calls it timeout-minutes. Change the comment at devcontainer-smoke/action.yml:8 to name the new Feature.
  4. Change the tools_lock path filter of devcontainer-image.yml:21 to the files that pin the devtools image.
  5. Delete tests/invariants/test_devcontainer_config.py:14-52 (it compares pins) and lower its config_reads.toml count.
  6. Docs and specs: update the specs ci-devcontainer-image, devcontainer-image-tools, devcontainer-workspace-image, cloudflared-release-pin and tflint-release-pin, and docs/DEVCONTAINER_USAGE.md. docs/DEVCONTAINER_USAGE.md:38 says that Renovate's devcontainer manager writes devcontainer-lock.json. That manager has no lockfile code, so fix the sentence: after a Feature bump, run devcontainer upgrade.
  7. After the merge: close build(devcontainer): move the docker-in-docker feature to 4 #5073 as not planned (the docker-in-docker Feature goes). Check fix(security): judge Trivy-config DS-0002 in .devcontainer/Dockerfile #5368 (DS-0002) and fix(security): judge Trivy-config DS-0013 in .devcontainer/Dockerfile #6136 (DS-0013) against the new Dockerfile, and close each one when its alert closes. The old dind-var-lib-docker-* volumes become orphans on the host; the owner can remove them with podman volume rm.

Privilege does not change: podman-in-podman is privileged, as docker-in-docker is today. podman-outside-podman goes in no image. The devcontainer image has no Trivy scan today; the devtools CI scans the base, and #6406 adds a report-only scan of this image. The Trivy gap on sid is recorded in SECURITY.md by #4361.

Renovate. Add a packageRule that groups ghcr.io/dan-petty/devtools for every manager (dockerfile, github-actions), so one PR moves every reference. Remove customManagers[4] (the Python minor of the apt package in .devcontainer/Dockerfile), the devcontainer Feature entries and the unused cli/cli rule (renovate.json:268-270). Rewrite the descriptions of packageRules 13 (argo), 14 (cloudflared) and 17 (node), which name the devcontainer copies.

Risk. Medium. podman-docker answers docker calls, so the output of docker info and similar commands can differ from Docker. Test it on the rootless Podman host. Child repositories must still find devops on PATH before post-create runs uv sync (comment at lines 361-365). The first pull of the new base is large once.

Podman Feature options (owner rules of 2026-11-19: no Docker CLI in the devops-cli container; Podman replaces Docker)

The podman-in-podman contract is in dan-petty/devcontainer-features#5. These points replace older text above where they differ:

(a) The smoke check and the Proof say "docker version shows a Podman server". Local rootless docker version prints only "Client: Podman Engine". Check that docker version prints "Podman Engine". Check the rootful service with podman --url unix:///var/run/docker.sock version, which shows a Server section.
(b) There are two stores. docker, podman and docker compose as vscode use the rootless store. devops docker images/build/push (SDK) and sudo podman use the rootful store. An image from docker build is not visible to devops docker push. Copy it with podman save <image> | sudo podman load. State this in the Risk paragraph and in docs/DEVCONTAINER_USAGE.md.
(c) docker compose runs podman-compose: rootless, with no socket.
(d) Correct the reason "devops-cli calls docker (4 modules under src/devops_cli ...)". devops-cli needs the API socket for the SDK. The docker command serves ci.yml, the extensions and manual use.
(e) Optional: DOCKER_CLI_HINTS in containerEnv has no effect without the Docker CLI.
(f) Set DOCKER_HOST=unix:///var/run/docker.sock in remoteEnv now. The VS Code server gives XDG_RUNTIME_DIR=/tmp/user/1000 to its extension host and to the agent processes under it; .devcontainer/ and the shell rc files do not set it. A bash login shell started from these processes reads /etc/profile.d/podman-docker.sh and gets DOCKER_HOST=unix:///tmp/user/1000/podman/podman.sock, where no service runs. devops-cli reads DOCKER_HOST before it looks for Podman sockets (engine.py order: CONTAINER_HOST, DOCKER_HOST, contexts, _find_podman_socket), so devops docker fails in that shell. The remoteEnv value reaches these processes: the remoteEnv PATH of devcontainer.json is in the environment of the extension host (measured). The value names the socket that Docker clients use by default, and podman and podman-compose ignore DOCKER_HOST, so it changes nothing else. zsh does not read /etc/profile.d, so most shells were not affected before. The Features set no DOCKER_HOST; the devcontainer can set it.
(g) Add a risk to the Risk paragraph. The devcontainer is debian:sid (the final stage of .devcontainer/Dockerfile), and aardvark-dns 1.17 there needs an inotify watch on /etc/resolv.conf. In the devcontainer, the VS Code server holds about 524100 of the 524288 inotify watches of the host user. Thus rootless docker compose name resolution fails ("ping: bad address"), and rootful network removal fails sometimes ("aardvark-dns failed to start"). The fix is on the host: raise fs.inotify.max_user_watches on the WSL2 host, or exclude large trees from VS Code file watching (files.watcherExclude). Link the issue that tracks the host fix.

Proof

  • The devcontainer-image workflow builds the image, and the smoke action passes on a stock runner and after a local rebuild on rootless Podman.
  • In the new devcontainer, kubectl version --client, helm version, minikube version, trivy --version, gh --version, openspec --version and semgrep --version exit 0.
  • grep VERSION_CODENAME /etc/os-release prints forky. podman run --rm quay.io/podman/hello works as vscode. docker version shows a Podman server. The docker run steps of ci.yml:497-503 work in the devcontainer.
  • git grep -n 'curl' origin/main -- .devcontainer/Dockerfile returns no release download.
  • After the merge, the DevContainer Image job averages under 360 s over 10 runs. Between two releases, GHCR shows only the project layer as new, plus the venv layer when uv.lock changes.

Depends on: dan-petty/devtools#1, dan-petty/devcontainer-features#5 (published, and its GHCR package made public by a person)

Proposed design

Problem statement

The DevContainer Image job averages 386 s, over the 5 min plus 1 min limit, because the Dockerfile rebuilds tools and Features on top of the src layer. The Dockerfile downloads and checks tools by hand, copies version pins, and rewrites /etc/os-release for docker-in-docker 2.17.0. The change builds the image FROM ghcr.io/dan-petty/devtools by digest, replaces Docker with Podman, removes the copied tool installs, and updates the build, tests, docs, specs and Renovate.

Acceptance criteria

Requirement: Devtools base image

The devcontainer Dockerfile SHALL build FROM ghcr.io/dan-petty/devtools at a digest.

Scenario: Devcontainer image build

  • WHEN the DevContainer Image workflow runs on the pull request
  • THEN the build job exits 0 and the smoke action passes.

Requirement: Hand tool stages removed

The devcontainer Dockerfile MUST remove the actionlint, tools and npm-tools stages, the hand curl and sha256sum downloads, the semgrep, bandit and ansible-core venvs, and the unpinned pre-commit install.

Scenario: Dockerfile tool-stage check

  • WHEN git grep -n -E 'FROM .*actionlint|FROM .*npm-tools|curl -fsSL|sha256sum -c|/devops-tools/(semgrep|bandit|ansible-core)|pip install.*pre-commit' -- .devcontainer/Dockerfile runs
  • THEN the command prints no line for those stages, downloads or installs.

Requirement: Project venv layer

The devcontainer image SHALL install the project virtual environment at /opt/devops-cli/.venv from uv export --locked --no-emit-project with --require-hashes, copy pyproject.toml, README.md and src/ last, and run as vscode.

Scenario: Venv and user in smoke check

  • WHEN the DevContainer Image workflow runs the smoke action
  • THEN the smoke action reports that command -v devops prints /opt/devops-cli/.venv/bin/devops and id -u prints 1000.

Requirement: Podman Feature

The devcontainer config SHALL keep only common-utils:2 with user vscode, uid and gid 1000, and podman-in-podman:1 with dockerCompat true and compose docker-compose.

Scenario: Docker compatibility in smoke check

  • WHEN the DevContainer Image workflow runs the smoke action
  • THEN the smoke action's devcontainer exec ... docker version exits 0 and shows a Podman server.

Requirement: Git config in remoteEnv

The devcontainer Dockerfile SHALL use # check=error=true, and the config SHALL put the GIT_CONFIG_* entries in remoteEnv.

Scenario: Build-check warning check

  • WHEN the DevContainer Image workflow runs the image build
  • THEN the build exits 0 and the log shows no SecretsUsedInArgOrEnv warning.

Requirement: Credential helper order

The devcontainer smoke action SHALL check the order of the GitHub credential helpers that the GIT_CONFIG_* entries set.

Scenario: Credential helper order in smoke check

  • WHEN the smoke action runs devcontainer exec ... git config --get-all credential.https://github.com.helper in the started image
  • THEN the command prints the empty value before !gh auth git-credential.

Requirement: Feature-aware build action

The devcontainer image build SHALL use the Dev Containers CLI from the devtools image in a job container.

Scenario: Build action check

  • WHEN the DevContainer Image workflow runs
  • THEN the build job exits 0 with two Features and the build log shows no devops install-tools step.

Requirement: Workflow path filter

The devcontainer-image.yml tools_lock path filter SHALL name the files that pin the devtools image.

Scenario: Digest change triggers workflow

  • WHEN a pull request changes the devtools digest in .devcontainer/Dockerfile
  • THEN the DevContainer Image workflow starts.

Requirement: Pin-comparison test removed

The project SHALL remove the devcontainer pin comparison from tests/invariants/test_devcontainer_config.py and lower the config_reads.toml count.

Scenario: Test-tree row

  • WHEN uv run devops ci --check --only test-tree runs
  • THEN the row exits 0 and tests/gate/tree_checks/config_reads.toml holds the lowered count for tests/invariants/test_devcontainer_config.py.

Requirement: Docs and specs updated

The docs and specs SHALL describe the devtools base, Podman and the devcontainer upgrade step.

Scenario: Documentation check

  • WHEN git grep -n 'devcontainer upgrade' docs/DEVCONTAINER_USAGE.md runs
  • THEN the command prints the sentence that tells the reader to run devcontainer upgrade after a Feature bump.

Requirement: Renovate devtools grouping

renovate.json SHALL group ghcr.io/dan-petty/devtools for the dockerfile and github-actions managers and remove the obsolete devcontainer, Python apt and cli/cli rules.

Scenario: Renovate config validation

  • WHEN npx --yes renovate-config-validator renovate.json runs
  • THEN the validator exits 0.

Existing Tool Considered

No alternatives check has run. The Dev Containers CLI covers the Feature-aware build and the digest push: it is pinned in src/devops_cli/tools_lock/tools.lock:605-609 and ships in the devtools image, and the current action already runs its devcontainer build --output type=image,push-by-digest=true,name-canonical=true,push=true --metadata-file command (.github/actions/devcontainer-image/action.yml:67-88). The official devcontainers/ci action covers a Feature-aware build but lacks a push-by-digest output and a --metadata-file pass-through (https://github.com/devcontainers/ci/blob/main/docs/github-action.md, fetched 2026-11-19), so it cannot keep the release flow that smoke-tests the digest before tagging. The podman-in-podman:1 Feature covers rootless Podman with dockerCompat. The change builds no replacement for these tools.

Key questions

  • Which base image should the devcontainer use, and how is its digest kept current?: Use ghcr.io/dan-petty/devtools by digest, as the Owner decisions of 2026-11-19 record. The repository describes it as the Debian sid devtools container image that holds the tools of the devops-cli devcontainer (https://github.com/dan-petty/devtools/tree/main, fetched 2026-11-19). Add a packageRule that groups every reference to ghcr.io/dan-petty/devtools for the dockerfile and github-actions managers, so one PR moves all references. Renovate already pins digests for both managers and groups docker digest updates (.github/renovate/base.json:70-74, .github/renovate/base.json:137-140). (best practice) [sources: https://github.com/dan-petty/devtools/tree/main, .github/renovate/base.json:70-74, .github/renovate/base.json:137-140]
    • Rejected: Keep the hand-built image. It rebuilds tools and Features on top of the src layer, so the job averages 386 s and exceeds the 5 min plus 1 min limit (AGENTS.md:11).
    • Chosen: Build FROM devtools by digest. It removes the copied tool installs and lets Renovate move one digest.
    • Rejected: Build FROM devtools by tag. A tag moves, so a rebuild would take a different image with no review; the digest is what Renovate pins.
  • Which container engine Feature replaces docker-in-docker?: Use ghcr.io/dan-petty/devcontainer-features/podman-in-podman:1 with dockerCompat: true (compose stays at its default, podman-compose; no Docker CLI, owner 2026-11-19). Remove docker-in-docker:2 and the /etc/os-release rewrite. (best practice) [sources: .devcontainer/image/devcontainer.json:16-21]
    • Rejected: Keep docker-in-docker:2. It is frozen at 2.17.0, does not support debian:sid, and needs the /etc/os-release rewrite.
    • Chosen: Use podman-in-podman:1. It supports the new base, and dockerCompat answers the docker calls of devops-cli and the Docker extensions.
  • Where should the GIT_CONFIG_ entries live?*: Move them from containerEnv to remoteEnv. This removes the four SecretsUsedInArgOrEnv warnings and keeps command-scope precedence. Do not use git config --system. The smoke action shall check that git config --get-all credential.https://github.com.helper prints the empty value before !gh auth git-credential. (best practice) [sources: .devcontainer/image/devcontainer.json:34-45]
    • Rejected: Keep them in containerEnv. They give four SecretsUsedInArgOrEnv build-check warnings, so the Dockerfile cannot use # check=error=true.
    • Chosen: Move them to remoteEnv. It removes the warnings and keeps the command-scope precedence.
    • Rejected: Use git config --system. It is not equivalent to the environment entries.
  • How should the image build run with two Features?: Run the Dev Containers CLI from the devtools image in a job container, and keep the devcontainer build --output type=image,push-by-digest=true,name-canonical=true,push=true command and its --metadata-file (.github/actions/devcontainer-image/action.yml:67-88). The official devcontainers/ci action covers a Feature-aware build but exposes no push-by-digest output or --metadata-file pass-through (https://github.com/devcontainers/ci/blob/main/docs/github-action.md, fetched 2026-11-19), so it cannot keep the release flow that smoke-tests the digest before tagging. The actions stop calling devops install-tools. (best practice) [sources: .github/actions/devcontainer-image/action.yml:47-49, .github/actions/devcontainer-image/action.yml:67-88, .github/actions/devcontainer-smoke/action.yml:25-27, https://github.com/devcontainers/ci/blob/main/docs/github-action.md]
    • Rejected: Plain docker build. A plain build does not apply the two Features.
    • Rejected: Dev Containers CLI through devcontainers/ci. The action pushes a tag and exposes no push-by-digest output or --metadata-file, so it cannot keep the digest-then-smoke-then-tag flow.
    • Chosen: Dev Containers CLI from the devtools image in a job container. It applies the Features, keeps the current digest push and metadata output, and needs no devops install-tools step.
  • What happens to minikube in this item?: Keep minikube from the devtools image through mise. Do not test the podman driver in this item; defer that scenario. (best practice) [sources: .devcontainer/image/devcontainer.json:22-26, https://github.com/dan-petty/devtools/tree/main]
    • Rejected: Keep minikube and test the podman driver now. The podman driver is not tested, so the main item cannot depend on it.
    • Chosen: Keep minikube and defer the driver scenario. The devtools image supplies minikube, and a later item can test the driver.
    • Rejected: Remove minikube. The owner decision keeps minikube.
  • Who makes the podman-in-podman GHCR package public?: The owner of dan-petty/devcontainer-features makes the GHCR package public. The devcontainer build cannot pull it until the package is public. (a person decides)

Open questions

  • Who makes the podman-in-podman GHCR package public? (a person decides)

Fit

Fits in one pull request.

Suspected block

Waits on dan-petty/devtools#1 to publish ghcr.io/dan-petty/devtools, on dan-petty/devcontainer-features#5, and on a person making the podman-in-podman GHCR package public.

Dependencies

None.

Alternatives check of 2026-11-19: in-use.
The repository already uses this tool.
Tool: devcontainers/cli (https://github.com/devcontainers/cli), MIT, last activity 2026-11-19, maintained.
Reason: Searches and the devcontainers/ci action docs confirm that action pushes tags only, while the Dev Containers CLI already does the Feature-aware build with push-by-digest and metadata that the issue's build step needs; the rest is repository configuration.

Covers:

  • Builds a devcontainer image with its Features applied
  • Push-by-digest output with a metadata file
  • Runs from the devtools image in a job container

Lacks:

  • No devtools base image or digest pinning
  • No Podman-in-Podman Feature or dockerCompat
  • No GIT_CONFIG_* move to remoteEnv or Renovate grouping

Sub-issues

Sub-issues

4 of 4 Issues completed
Loading 4 sub-issues

Activity

  1. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
    • Priority: P0-Critical. The DevContainer Image job averages 386 s and 13 of 18 runs exceed the 5 min 1 s limit, which is a CI slowness issue.
    • Related: feat(devcontainer): use or build Dev Container Features for the tools #4368, which asks for a different change. Both items change how tools enter the devcontainer image, but #4368 adds Dev Container Features while the candidate builds FROM a devtools image that already has the tools.
  2. added
    type/bug
    source/agent
    status/new
    effort/high
    value/high
    scope/devcontainer
    priority/p0-critical
    on Nov 19, 2026
  3. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (4)

    Tools considered:

    Searches run:

    • devcontainers/ci GitHub Action push by digest metadata file support, results: 5
    • devcontainer CLI build push-by-digest metadata-file Feature build, results: 5
    • "devcontainers/ci" devcontainer build action, results: 5
    • devcontainer CLI official reference build push image, results: 5

    Sources:

  5. added
    owner/agent
    on Nov 19, 2026
  6. added
    status/in-progress
    and removed
    status/new
    on Nov 19, 2026
  7. added
    status/in-review
    and removed
    status/in-progress
    on Nov 19, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 20, 2026
  9. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-20 01:51 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p0-criticalscope/devcontainersource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions