I’ve previously blogged about debugging .NET Docker containers in VS Code but recently I came across a problem with a container that I had a .NET Core application in failing to connect the debugger with the following error:
Executing: docker.exe exec -i sunshine-functions sh -s < /home/aaron/.vscode-remote/extensions/ms-vscode.csharp-1.19.1/scripts/remoteProcessPickerScript
Linux
stderr: sh: 1: ps: not found
Error Message: Command failed: docker.exe exec -i sunshine-functions sh -s < /home/aaron/.vscode-remote/extensions/ms-vscode.csharp-1.19.1/scripts/remoteProcessPickerScript
sh: 1: ps: not found
THe crux of the problem is that it’s unable to list the processes that I need to pick from in VS Code.
The image I was using as my base image was the Azure Functions Host, specifically mcr.microsoft.com/azure-functions/dotnet
and it turns out that this particular image doesn’t have ps
anywhere in it!
Thankfully, this is an easy fix, you need to install procps
using apt install
, assuming your image is from a distro that supports apt
of course. 😉
Once ps
is installed into your image you’ll now be able to list the processes and then debug your image.