Repository: dotnet/dotnet-docker

Issue #1922: PowerShell Core cannot start a PS Job in .NET Core SDK Alpine image
Created: 2020-05-15T14:59:22Z
Steps to reproduce the issue
docker run -it --rm mcr.microsoft.com/dotnet/core/sdk:3.1.202-alpine3.11 pwsh -Command "& { Start-Job { 'test' } | Receive-Job -Wait }"

Expected behavior
test

Actual behavior
OpenError: [localhost] An error occurred while starting the background process. Error reported: No such file or directory.

Additional information
This issue happens only in the SDK image - if I install PowerShell by following steps on Installing PowerShell on Linux, then this problem doesn't seem to occur.
For a comparison, this works as expected:
docker run -it --rm mcr.microsoft.com/powershell:lts-alpine-3.10 pwsh -Command "& { Start-Job { 'test' } | Receive-Job -Wait }"

The extra problem with the SDK image is that I can't run dotnet tool update or dotnet tool uninstall to replace the tool with a working version of powershell core because both fail with error:
dotnet tool uninstall --tool-path /usr/share/powershell powershell.linux.alpine
Failed to uninstall tool package 'powershell.linux.alpine': Cross-device link

Output of docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:23:10 2020
 OS/Arch:           windows/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info
Client:
 Debug Mode: false
 Plugins:
  app: Docker Application (Docker Inc., v0.8.0)
  buildx: Build with BuildKit (Docker Inc., v0.3.1-tp-docker)
  mutagen: Synchronize files with Docker Desktop (Docker Inc., testing)

Server:
 Containers: 33
  Running: 0
  Paused: 0
  Stopped: 33
 Images: 105
 Server Version: 19.03.8
 Storage Driver: overlay2
  Backing Filesystem: <unknown>
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.76-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.945GiB
 Name: docker-desktop
 ID: GLOX:A5WL:ESZ4:LPSH:C7UZ:GQRP:TIPV:WXZO:6KKB:I7Y3:MDOF:INPX
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 40
  Goroutines: 52
  System Time: 2020-05-15T14:58:35.816208472Z
  EventsListeners: 3
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Duplicate issue #4735: Start-Job or pwsh does not work on the Alpine 3.18 images
Created: 2023-07-10T08:57:11Z
Hello,
I've tried to convert our existing system to an Alpine-based one.
However, it seems I'm having an issue:
Here it goes: I'm using the following image:
mcr.microsoft.com/dotnet/sdk:7.0-alpine3.18
The image seems to have pwsh installed, as if I run:
PS C:> docker run -it mcr.microsoft.com/dotnet/sdk:7.0-alpine3.18 pwsh
I get:
PowerShell 7.3.4
PS />

However, once I'm there I cannot restart a new pwsh instance:
PS /> pwsh
ResourceUnavailable: Program 'pwsh' failed to run: An error occurred trying to start process '/usr/share/powershell/.store/powershell.linux.alpine/7.3.4/powershell.linux.alpine/7.3.4/tools/net7.0/any/pwsh' with working directory '/'. No such file or directoryAt line:1 char:1
+ pwsh
+ ~~~~.

nor use the Start-Job command:
PS /> Start-Job { Get-ChildItem }

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
3      Job3            BackgroundJob   Failed        False           localhost             Get-ChildItem

Thank you in advance for your time,
Regards,

Closing comment (2023-08-09T18:39:54Z): This is a duplicate of #1922