Interacting with NuGet fails on .NET 6.0.10 when running in docker with user
- Dominant language
- PowerShell
- Stars
- 22k
- Forks
- 4.9k
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 29
Description
### Description
We use the .NET SDK docker image to build our solution. Since the image `mcr.microsoft.com/dotnet/sdk:6.0` has been updated (10.10.2022 / .NET 6.0.10), we are encountering the following error when interacting with NuGet. This error happens only when we use a specific user (-u 1000:1000) to run the command.
Steps to Reproduce:
- Run Docker image and mount an existing solution: `sudo docker run -it -u 1000:1000 -e DOTNET_CLI_HOME=/tmp --rm --net=host --mount type=bind,source=/path/to/sln,target=/project mcr.microsoft.com/dotnet/sdk:6.0`
- navigate to sln: `cd /project`
- list nuget sources `dotnet nuget list source`
Error:
```
Unhandled exception. System.UnauthorizedAccessException: Access to the path '/.local/share/NuGet/Migrations' is denied.
---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at System.IO.FileSystem.CreateDirectory(String fullPath)
at System.IO.Directory.CreateDirectory(String path)
at NuGet.Common.Migrations.MigrationRunner.GetMigrationsDirectory()
at NuGet.Common.Migrations.MigrationRunner.Run()
at NuGet.CommandLine.XPlat.Program.MainInternal(String[] args, CommandOutputLogger log)
at NuGet.CommandLine.XPlat.Program.Main(String[] args)
```
We tried to define a configuration to define the directory, as ` /.local` does not exist, but we did not find any way to do this.
### Configuration
- .NET 6.0.10 (through docker image `mcr.microsoft.com/dotnet/sdk:6.0`
- Occurs on multiple Environment Setup
- Windows, WSL, Ubuntu 20.04
- Windows, Docker Desktop
- Jenkins, Ubuntu 20.04 Agent
### Regression?
It had worked with an already downloaded docker image. After deleting the image and pulling it again, this error started to occur.
### Comment
Listing the NuGet sources was the first command we encountered failing, but neither do `dotnet restore` nor `dotnet build`.
Contributor guide
Assessment
This issue has not been assessed yet.