Build context for a Dev Container Feature is invalidated on every build
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 64/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript
- Lĩnh vực
- build-system, cli
Hướng nghiên cứu
Bắt đầu với bản tái hiện feature-starter, devcontainer.json của nó và entry point devcontainer build --docker-path=/usr/bin/podman. So sánh các build lặp lại và kiểm tra các thư mục tarball của feature dưới /tmp/devcontainercli-foo/container-features; hoàn thành khi một build không thay đổi sử dụng lại layer cài đặt feature, trong khi các thay đổi liên quan trong đầu vào vẫn làm layer đó mất hiệu lực.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 3k
- Fork
- 463
- Merge trung bình
- 13 giờ 28 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của devcontainers/cli
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
devcontainers/cli#1203 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
devcontainers/cli#1178 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
devcontainers/cli#1317 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
devcontainers/cli#1308 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
build rejects valid tag@digest image references during registry inspectionCó thể đã có người làm @v-Kaniska244 đã nhận 8 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
devcontainers/cli#1307 · 2 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của devcontainers/cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Doist/todoist-cli#576 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Suggestion: document (or optionally add) a cheaper-model config for find-skills on Claude CodeĐang mởfeature
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
vercel-labs/skills#2370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 Bug supabase/cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
CopilotKit/aimock#491 ·
Maintainer thường phản hồi trong vòng 1 ngày