This post describes how to create docker hosted devops build agent. The only change I made was for the Dockerfile to use FROM mcr.microsoft.com/dotnet/sdk:7.0 as the base image rather than vanilla ubuntu.
I've run through this and it works great to build a dotnet console app, using a container running in Azure container apps. However, if I use the same agent for a devops pipeline that builds an Azure Function app, I get the following error:
[error]/home/agentuser/.nuget/packages/microsoft.net.sdk.functions/4.1.1/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): Error : You must install or update .NET to run this application.
I guess this is because there are SDKs missing from the base image.
This blog post describes how "packer" can be used to create a VHD with the required dependencies. Has anyone followed something similar to create an agent running in a docker container rather than a VM?