Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Subshell command in build options not executed

Đang mở
#877 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
28/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
docker, shell, typescript
Lĩnh vực
cli, devops

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện vấn đề với ví dụ build.options trong devcontainer.json và trường hợp emptytestscript.sh, sau đó so sánh lệnh được tạo trong devContainersSpecCLI.js với cùng lệnh được chạy trong terminal. Theo dõi cách các tùy chọn build được truyền vào docker buildx; hoàn thành khi phép thay thế lệnh và các tùy chọn dựa trên dấu backtick hoạt động như mong đợi và build chấp nhận các đối số thu được.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

feature-request

I have devcontainer.json setup like this

"build": {
        "dockerfile": "${localWorkspaceFolder}/docker/development/Dockerfile",
        "context": "${localWorkspaceFolder}",
        "options": [
            "$(awk '{ sub (\"\\\\\\\\$\", \" \"); printf \" --build-arg %s\", $0  } END { print \"\"  }' ${localWorkspaceFolder}/.env)"
        ]
},

awk command in options should read specified .env file and create --build-arg for every one of them.

Unfortunately when i run build command i get this error.

[3829 ms] Start: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-rijad/container-features/0.65.0-1724398400319/Dockerfile-with-features -t vsc-asx-ubuntu-627ff9ecdd16cefae9d376770411bccfd81a6bb640f586cfb01f9d12f1afe637 --target dev_containers_target_stage --no-cache --pull $(awk '{ sub ("\\\\$", " "); printf " --build-arg %s", $0  } END { print ""  }' /home/rijad/asx-ubuntu/.env) --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/rijad/asx-ubuntu

ERROR: "docker buildx build" requires exactly 1 argument.
See 'docker buildx build --help'.

Usage:  docker buildx build [OPTIONS] PATH | URL | -
Start a build
[3861 ms] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-rijad/container-features/0.65.0-1724398400319/Dockerfile-with-features -t vsc-asx-ubuntu-627ff9ecdd16cefae9d376770411bccfd81a6bb640f586cfb01f9d12f1afe637 --target dev_containers_target_stage --no-cache --pull $(awk '{ sub ("\\\\$", " "); printf " --build-arg %s", $0  } END { print ""  }' /home/rijad/asx-ubuntu/.env) --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/rijad/asx-ubuntu
[3861 ms]     at mtA (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:466:1933)
[3861 ms]     at async Pm (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:465:1856)
[3861 ms]     at async NH (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:465:610)
[3861 ms]     at async KtA (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:482:3771)
[3861 ms]     at async eB (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:482:4886)
[3861 ms]     at async hrA (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:663:200)
[3861 ms]     at async lrA (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:662:13452)
[3864 ms] Exit code 1
[3867 ms] Command failed: /home/rijad/.vscode-server/bin/5437499feb04f7a586f677b155b039bc2b3669eb/node /home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js up --container-session-data-folder /tmp/devcontainers-21dbc736-475c-42b1-9342-59f47582801d1724398396161 --workspace-folder /home/rijad/asx-ubuntu --workspace-mount-consistency cached --id-label devcontainer.local_folder=\\wsl.localhost\Ubuntu\home\rijad\asx-ubuntu --id-label devcontainer.config_file=/home/rijad/asx-ubuntu/.devcontainer/asx/devcontainer.json --log-level debug --log-format json --config /home/rijad/asx-ubuntu/.devcontainer/asx/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/mnt/wslg/runtime-dir/wayland-0,target=/tmp/vscode-wayland-476063ef-ff4c-4372-bf8d-ee68a591f2b0.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[3867 ms] Exit code 1

But if I take command

docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-rijad/container-features/0.65.0-1724398400319/Dockerfile-with-features -t vsc-asx-ubuntu-627ff9ecdd16cefae9d376770411bccfd81a6bb640f586cfb01f9d12f1afe637 --target dev_containers_target_stage --no-cache --pull $(awk '{ sub ("\\\\$", " "); printf " --build-arg %s", $0 } END { print "" }' /home/rijad/asx-ubuntu/.env) --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/rijad/asx-ubuntu
and paste it in my terminal, it runs with no issue.

Also other ways of spawning subshell, like backticks do not work as well.

Even if i create empty test script with exec permissions and try

"options": [
    "$(${localWorkspaceFolder}/emptytestscript.sh)"
]

it ends up with same error.

I am running wsl Ubuntu on windows 10.

Ngôn ngữ chính
TypeScript
Star
3k
Fork
461
Merge trung bình
18 phút
Pull request đã merge (30 ngày)
5

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của devcontainers/cli

Tất cả issue của devcontainers/cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.