When building my windows dockerfile (.net core nano)...
docker build -f *** -t ***:*** --build-arg ARG1=foo --build-arg ARG2=bar .
I'm getting an error during the build that occurs in response to my first RUN
command. The command will fail with the following message:
ERROR: failed to solve: process "cmd /S /C dotnet restore \"myproject.csproj\"" did not complete successfully: unable to find user ContainerUser: invalid argument
In my case this is a dotnet restore
command but any RUN
statement will result in:
unable to find user ContainerUser: invalid argument
Note that the defualt user for windows nanoserver containers is ContainerUser
. If I designate another user eg. USER ContainerAdministrator
prior to the RUN
statement, the same failure occurs for that user too (unable to find user ContainerAdministrator: invalid argument
).
Dockerfile snippet:
FROM mcr.microsoft.com/dotnet/sdk:7.0-nanoserver-1809 AS build
WORKDIR /src
COPY ["myproject.csproj", "myproject/"]
RUN dotnet restore "myproject/myproject.csproj" <--- Error thrown here (user not found)
The caveat is that this is only occuring when ran from a github actions workflow on a self-hosted windows runner. The Dockerfile builds in other environments no problem and has been deployed successfully. However I don't have access to the runner, so I'm trying to troubleshoot from afar.
Any ideas as to what would cause the user to not be found in the container? I'm having a hard time finding any documentation around this. Thanks