dotnet paket restore failed while building docker image
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 2.1k
- Forks
- 528
- Avg merge
- 1d 12m
- Merged PRs (30d)
- 54
Description
Description
The command "dotnet paket restore" exited with code 1.
Repro steps
Please provide the steps required to reproduce the problem
-
Install paket as .Net core Local tool
POCs\HelloDI> dotnet new tool-manifest
POCs\HelloDI> dotnet tool install paket
POCs\HelloDI> dotnet paket init -
add /bin & /obj to .dockerignore file at root folder
.git
**/bin/
**/obj/
-
add package to .csproject
POCs\HelloDI> cd .\src\HelloDI.Console\
POCs\HelloDI\src\HelloDI.Console> dotnet paket add Microsoft.Extensions.Configuration.Json --interactive -
Docker file contents (
src\HelloDI.Console\Dockerfile)
ARG VERSION=3.1-alpine3.12
FROM mcr.microsoft.com/dotnet/core/sdk:$VERSION as build-env
WORKDIR /HelloDI.Console
COPY /src/HelloDI.Console/*.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish src/HelloDI.Console/HelloDI.Console.csproj --output /out/ --configuration Release
FROM mcr.microsoft.com/dotnet/core/runtime:$VERSION as runtime
WORKDIR /HelloDI.Console
COPY --from=build-env /out .
ENTRYPOINT ["dotnet", "HelloDI.Console.dll"]
- Local Msbuild successful.
POCs\HelloDI\src\HelloDI.Console> cd ..\..
POCs\HelloDI> dotnet build
Output
Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Paket version 5.247.4
The last restore is still up to date. Nothing left to do.
Performance:
- Runtime: 228 milliseconds
Paket version 5.247.4
Starting restore process.
Performance:
- Runtime: 1 second
Restored D:\@aviWin10.workspace\@POCs\HelloDI\tests\HelloDI.Console.Tests\HelloDI.Console.Tests.csproj (in 9.3 sec).
1 of 2 projects are up-to-date for restore.
.....
- Error during-Build Docker image
POCs\HelloDI> docker build -t hello-di/console:0.1 -f ./src/HelloDI.Console/dockerfile .
Output
Step 5/11 : RUN dotnet restore
---> Using cache
---> a3b73898202f
Step 6/11 : COPY . .
---> 65085b0c2d6f
Step 7/11 : RUN dotnet publish src/HelloDI.Console/HelloDI.Console.csproj --output /out/ --configuration Release
---> Running in f16be0b6c474
Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Run "dotnet tool restore" to make the "paket" command available.
/HelloDI.Console/.paket/Paket.Restore.targets(171,5): error MSB3073: The command "dotnet paket restore" exited with code 1.
[/HelloDI.Console/src/HelloDI.Console/HelloDI.Console.csproj]
The command '/bin/sh -c dotnet publish src/HelloDI.Console/HelloDI.Console.csproj --output /out/ --configuration Release' returned a non-zero code: 1
Expected behavior
dotnet paket restore should execute successfully.
Actual behavior
error at dotnet paket restore
Known workarounds
remove **/obj/ from .dockerignore
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied Dockerfile and root .dockerignore, then inspect .paket/Paket.Restore.targets around line 171. Reproduce with the listed docker build command, compare behavior when **/obj/ is excluded or included, and consider the issue done when dotnet paket restore completes successfully during the image build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, fsharp
- Domain
- build-system, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100