I used this tutorial to put my asp.net Core Application inside a Docker Container
https://code.visualstudio.com/docs/containers/quickstart-aspnet-core
But get an permission Denied inside the container:
10:39:02 /usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5): error : Access to the path '/src/obj' is denied. [/src/Lankoon.csproj]
10:39:02 /usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5): error : Permission denied [/src/Lankoon.csproj]
10:39:02 The command '/bin/sh -c dotnet restore "./Lankoon.csproj"' returned a non-zero code: 1
I tried it on a Windows10 Machine and also on an Jenkins Build Server, the result is the same.
I don't understand as which user the nuget is running?
Can anyone help?
Add the following line to you dockerfile
USER root
The problem inside my container was that the user was not root and dotnet restore unfortunately need root access.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With