You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are experiencing a concurrency issue when running dotnet restore in a multi-stage Docker build. The issue occurs when multiple independent dotnet restore steps are executed simultaneously, leading to file access conflicts in the shared NuGet package cache directory (/root/.nuget/packages). We prefer to restore these solutions in parallel, as we need to handle tens of solutions, and performance is a critical factor.
When executing docker build -f build.Dockerfile, the following errors appear:
/usr/share/dotnet/sdk/8.0.405/NuGet.targets(174,5): error : Could not find file '/root/.nuget/packages/system.runtime.interopservices/4.1.0/shgqghmt.ntf'. [/src/Utilities/Utilitiessln]
/usr/share/dotnet/sdk/8.0.405/NuGet.targets(174,5): error : Could not find file '/root/.nuget/packages/microsoft.extensions.dependencymodel/1.1.2/2vyfq0a1.tgs'. [/src/Core/Core.sln]
To Reproduce
#syntax=docker/dockerfile:1.7-labsFROM mcr.microsoft.com/dotnet/sdk:8.0 AS base-build
WORKDIR /src
COPY ["nuget.config", ""]
COPY ["Directory.Build.props", ""]
COPY ["Directory.Packages.props", ""]
FROM base-build AS core-restore
COPY --parents Core/**/*.csproj Core/**/*.sln ./
RUN --mount=type=cache,target=/root/.nuget/packages \
dotnet restore "Core/Core.sln" --packages /root/.nuget/packages
FROM base-build AS data-restore
COPY --parents Data/**/*.csproj Data/**/*.sln ./
RUN --mount=type=cache,target=/root/.nuget/packages \
dotnet restore "Data/Data.sln" --packages /root/.nuget/packages
FROM base-build AS utilities-restore
COPY --parents Utilities/**/*.csproj Utilities/**/*.sln ./
RUN --mount=type=cache,target=/root/.nuget/packages \
dotnet restore "Utilities/Utilities.sln" --packages /root/.nuget/packages
Logs
[core-restore 2/4] RUN --mount=type=cache,target=/root/.nuget/packages dotnet restore "Core/Core.sln" --packages /root/.nuget/packages:
4.703 Determining projects to restore...
14.58 Restored /src/Core/Proj1/Proj1.csproj (in 1.32 sec).
18.78 /usr/share/dotnet/sdk/8.0.405/NuGet.targets(174,5): error : Could not find file '/root/.nuget/packages/microsoft.extensions.dependencymodel/1.1.2/2vyfq0a1.tgs'. [/src/Core/Core.sln]
------
------
> [utilities-restore 2/2] RUN --mount=type=cache,target=/root/.nuget/packages dotnet restore "Utilities/Utilities.sln" --packages /root/.nuget/packages:
4.524 Determining projects to restore...
8.490 Restored /src/Utilities/Proj1.csproj (in 1.72 sec).
13.36 Restored /src/Utilities/Proj2.csproj (in 6.56 sec).
13.65 Restored /src/Utilities/Proj3.csproj (in 6.91 sec).
13.67 Restored /src/Utilities/Proj4.csproj (in 6.92 sec).
18.62 /usr/share/dotnet/sdk/8.0.405/NuGet.targets(174,5): error : Could not find file '/root/.nuget/packages/system.runtime.interopservices/4.1.0/shgqghmt.ntf'. [/src/Utilities/Utilitiessln]
------
ERROR: failed to solve: process "/bin/sh -c dotnet restore \"Utilities/Utilities.sln\" --packages /root/.nuget/packages" did not complete successfully: exit code: 1
The text was updated successfully, but these errors were encountered:
dobri-popov-tiebreak-solutions
changed the title
Concurrency Issue with "dotnet restore" in Multi-Stage Docker Build
Concurrency Issue with dotnet restore in Multi-Stage Docker Build
Feb 5, 2025
Thanks for creating this issue! We believe this issue is related to NuGet tooling, which is maintained by the NuGet team. Thus, we closed this one and encourage you to raise this issue in the NuGet repository instead. Don’t forget to check out NuGet’s contributing guide before submitting an issue!
If you believe this issue was closed out of error, please comment to let us know.
We are experiencing a concurrency issue when running
dotnet restore
in a multi-stage Docker build. The issue occurs when multiple independentdotnet restore
steps are executed simultaneously, leading to file access conflicts in the shared NuGet package cache directory (/root/.nuget/packages
). We prefer to restore these solutions in parallel, as we need to handle tens of solutions, and performance is a critical factor.When executing
docker build -f build.Dockerfile
, the following errors appear:To Reproduce
Logs
The text was updated successfully, but these errors were encountered: