Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Subshell command in build options not executed

オープン
#877 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
28/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
docker, shell, typescript
領域
cli, devops

調査の方向性

まず、devcontainer.json の build.options の例と emptytestscript.sh のケースで問題を再現し、その後、devContainersSpecCLI.js で生成されるコマンドを、ターミナルで実行した同じコマンドと比較します。build オプションが docker buildx にどのように渡されるかを追跡します。コマンド置換とバッククォートベースのオプションが期待どおりに動作し、ビルドが結果の引数を受け入れれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
3k
フォーク
461
平均マージ
18分
マージ済み PR(30日)
5

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

devcontainers/cli のほかの issue

devcontainers/cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。