microsoft / microsoft/vscode-containers
dotnet container sdk publish throws error for chiseled (shell-less) images
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 139
- Forks
- 87
- Avg merge
- 9h 15m
- Merged PRs (30d)
- 9
Description
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",
},
},
]
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/tasks/netSdk/netSdkTaskUtils.ts around the entrypoint assignment linked in the issue, then compare it with the dockerRun.entrypoint shown in tasks.json. Reproduce the dotnet publish and docker container run commands against the shell-less chiseled image. Done means the generated command does not force /bin/sh or honors the configured entrypoint without breaking the existing Windows behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, typescript
- Domain
- devops, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100