dotnet container sdk publish throws error for chiseled (shell-less) images

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

メンテナーはふだん 1 日以内に返信

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

評価

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

調査の方向性

src/tasks/netSdk/netSdkTaskUtils.ts の、issue でリンクされている entrypoint の割り当て付近から始め、tasks.json に示されている dockerRun.entrypoint と比較します。shell のない chiseled image に対して dotnet publish と docker container run コマンドを再現します。生成されたコマンドが /bin/sh を強制せず、または既存の Windows の動作を壊さずに設定された entrypoint を尊重すれば完了です。

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

説明

.NET

Type: Bug

Observed behaviour:
When using a dotnet project with sdk container support regardless of image alwasys produces a container run command with entrypoint '/bin/sh' (or 'cmd.exe' for windows).

Expected behaviour:
generated container run to either not force an entrypoint, or honor it to be overridden via tasks.json.

Suspected cause:
https://github.com/microsoft/vscode-containers/blob/bec88c1a3cd48d9446753e97a3d9244df08dedb5/src/tasks/netSdk/netSdkTaskUtils.ts#L58
entrypoint: await getDockerOSType() === 'windows' ? 'cmd.exe' : '/bin/sh'

Additional info:
see below for a redacted snippet of the terminal output.

> dotnet publish --os "linux" --arch "x64" /t:PublishContainer --configuration "Debug" -p:ContainerImageTag=dev <

  Determining projects to restore...
  All projects are up-to-date for restore.
  Web -> c:\Web\bin\Debug\net9.0\linux-x64\Web.dll
  Web -> c:\Web\bin\Debug\net9.0\linux-x64\publish\
  Building image 'web' with tags 'dev' on top of base image 'mcr.microsoft.com/dotnet/aspnet:9.0-noble-chiseled-extra'.
  Pushed image 'web:dev' to local registry via 'docker'.

Workload updates are available. Run `dotnet workload list` for more information.
> docker container run --detach --tty --rm --name "budgetizeweb-dev" --publish-all --mount "type=bind,source=C:\.vsdbg,destination=/remote_debugger,readonly" --label "com.microsoft.created-by=visual-studio-code" --entrypoint "/bin/sh" web:dev <

eb3bbc09abf17631dd002c2c3f92812c046d6020e164233a9fcbc71cc80fc4a2
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown

Run 'docker run --help' for more information
Process exited with code 127

and also a redacted snippet from my tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Run .NET Image",
            "type": "docker-run",
            "netCore": {
                "appProject": "${workspaceFolder}/Web/Web.fsproj",
            },
            "dockerRun": {
                "image": "web:dev",
                "containerName": "web-dev",
                "entrypoint": "dotnet",                
            }
        },
        {
            "label": "Run .NET Image - Container SDK",
            "type": "dotnet-container-sdk",
            "netCore": {
                "appProject": "${workspaceFolder}/Web/Web.fsproj",
            },            
            "dockerRun": {
                "image": "web:dev",
                "containerName": "web-dev",
                "entrypoint": "dotnet",
            },
        },
    ]
}
主要言語
TypeScript
スター
147
フォーク
93
平均マージ
9時間 16分
マージ済み PR(30日)
14

環境構築

はじめの一歩

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

microsoft/vscode-containers のほかの issue

microsoft/vscode-containers の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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