Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Build context for a Dev Container Feature is invalidated on every build

Abierto
#1,262 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
64/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
build-system, cli

Línea de trabajo

Comienza con la reproducción de feature-starter, su devcontainer.json y el punto de entrada devcontainer build --docker-path=/usr/bin/podman. Compara builds repetidos e inspecciona los directorios de los tarballs de features bajo /tmp/devcontainercli-foo/container-features; se considera terminado cuando un build sin cambios reutiliza la capa de instalación de la feature, mientras que los cambios relevantes en la entrada aún la invalidan.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Current behavior

The build context for a Dev Container Feature is invalidated on every build, even when there are no changes to the Containerfile, devcontainer.json, or any files included in the build context.

As a result, the feature installation layer is rebuilt every time instead of reusing the existing cache.

Expected behavior

The Dev Container Feature layer should reuse the build cache whenever possible and only be rebuilt when relevant inputs have changed.

Environment

Component Version
OS Ubuntu 24.04 (Kernel 6.8.0-134-generic)
Arch x86_64
Container runtime Podman 4.9.3
VS Code 1.112.0
Dev Container CLI 0.87.0

Steps to reproduce

cd /tmp
git clone https://github.com/devcontainers/feature-starter.git
cd feature-starter

Remove the docker-in-docker feature and add the following feature to devcontainer.json:

"ghcr.io/devcontainers/feature-starter/color:1": {
    "favorite": "green"
}

Build the dev container:

devcontainer build --docker-path=/usr/bin/podman

Build it again without making any changes:

devcontainer build --docker-path=/usr/bin/podman

Notice that the layer responsible for installing the feature is rebuilt instead of being restored from cache:

[2/2] STEP 5/9: RUN echo "_CONTAINER_USER_HOME=$( (command -v getent >/dev/null 2>&1 && getent passwd 'root' || grep -E '^root|^[^:]*:[^:]*:root:' /etc/passwd || true) | cut -d: -f6)" >> /tmp/dev-container-features/devcontainer-features.builtin.env && echo "_REMOTE_USER_HOME=$( (command -v getent >/dev/null 2>&1 && getent passwd 'node' || grep -E '^node|^[^:]*:[^:]*:node:' /etc/passwd || true) | cut -d: -f6)" >> /tmp/dev-container-features/devcontainer-features.builtin.env
--> Using cache c466b018334665827c5d83c2c00f910ce7f80e4bff6b0eb508ac254590faffba
--> c466b0183346

[2/2] STEP 6/9: RUN --mount=type=bind,from=dev_containers_feature_content_source,source=color_0,target=/tmp/build-features-src/color_0 \
    cp -ar /tmp/build-features-src/color_0 /tmp/dev-container-features \
 && chmod -R 0755 /tmp/dev-container-features/color_0 \
 && cd /tmp/dev-container-features/color_0 \
 && chmod +x ./devcontainer-features-install.sh \
 && ./devcontainer-features-install.sh \
 && rm -rf /tmp/dev-container-features/color_0

===========================================================================
Feature       : My Favorite Color
Description   : A feature to remind you of your favorite color
Id            : ghcr.io/devcontainers/feature-starter/color
Version       : 1.0.3
Options       :
    FAVORITE="green"
===========================================================================

Activating feature 'color'
The provided favorite color is: green
...
...

Additional observations

I am not sure exactly how feature tarballs are fetched and unpacked internally, but it appears that the feature tarball is downloaded on every invocation and extracted into a versioned directory under /tmp whose name changes each run.

For example:

$ ls -lh /tmp/devcontainercli-foo/container-features
total 52K
drwxrwxr-x 4 mv mv 4.0K Jul  6 19:15 0.87.0-1783358140200
drwxrwxr-x 4 mv mv 4.0K Jul  6 19:16 0.87.0-1783358186697
drwxrwxr-x 4 mv mv 4.0K Jul  6 19:17 0.87.0-1783358228464

This changing directory name is most likely to be contributing to cache invalidation.

Lenguaje dominante
TypeScript
Estrellas
3k
Forks
463
Merge medio
13 h 28 min
PR fusionados (30 d)
2

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de devcontainers/cli

Todos los issues de devcontainers/cli

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.