I am currently working with the azure build pipeline to build my .NET application and create docker image using self-hosted agent and docker desktop. after creating the image, image will be pushed to Azure Container Registry (ACR). But, when my pipeline is running it's failed to build the image, because my self-hosted agent couldn't find the docker daemon, though my local docker-desktop is running properly. Please check the steps that I have done and want to.
Pipeline:
Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Project.API/Project.API.csproj", "Project.API/"]
RUN dotnet restore "Project.API/Project.API.csproj"
COPY . .
WORKDIR "/src/Project.API"
RUN dotnet build "Project.API.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Project.API.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Project.API.dll"]
Error