Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build stopped working #4512

Open
luismanuelmontoro opened this issue Apr 3, 2020 · 19 comments
Open

Docker build stopped working #4512

luismanuelmontoro opened this issue Apr 3, 2020 · 19 comments

Comments

@luismanuelmontoro
Copy link

Docker build stopped working

Hello, i have a dockerfile than build correctly, but 5 days ago without any change in code i´ll stop building.

Dokcer build response me that:

Restore completed in 159.68 ms for /app/s3-api/gutenberg-s3.csproj.
/usr/share/dotnet/sdk/3.1.200/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1064: Package AWSSDK.S3, version 3.3.110.35 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [/app/s3-api/gutenberg-s3.csproj]
The command '/bin/sh -c dotnet publish gutenberg-s3.csproj -c Release -o out' returned a non-zero code: 1

Y try to locate this package on nugget and it´s fine. I actualize librarys and still crashing.

Can you help me?

@Mousaka
Copy link

Mousaka commented Apr 16, 2020

Got something similar =(

#16 1.084   Restore completed in 33.44 ms for /app/src/InsuranceCase/InsuranceCase.fsproj.
#16 1.251 /usr/share/dotnet/sdk/3.1.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1064: Package Fable.Core, version 3.0.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [/app/src/InsuranceCase/InsuranceCase.fsproj]

Works to build locally but not in docker

@luismanuelmontoro
Copy link
Author

try to change from this version: 3.1-alpine3.10 to this version 3.1.100-alpine if you are using alpine

@Mousaka
Copy link

Mousaka commented Apr 16, 2020

That worked!!

Such a weird problem though... Some of my colleagues did not need to change from 3.1-alpine to 3.1.100-alpine but at least 2 of them get the same problem.

Thanks @luismanuelmontoro !

@bmsjarbas
Copy link

Hi folks, I got this problem here too. In my case that just happens when using macOS and Docker for Mac. While I tried the same but using a linux machine, then all that worked fine. Not even necessary to change the version.

@hellgrenj
Copy link

The same happened for me just now. With the same error message. The build worked a couple of days ago but its not working now. The Nuget package(s) exist and dotnet restore works outside of docker.
when i revert to 3.1.100-buster or 3.1.100-alpine it works.

@saidaisri
Copy link

Some issue with latest Dotnet Core Docker SDK release and AWS SDK
https://github.com/dotnet/core/blob/master/release-notes/3.1/README.md
image

Using 3.1.100-buster version of Dotnet Core SDK for build in Dockerfile fixed the issue
FROM mcr.microsoft.com/dotnet/core/sdk:3.1.100-buster AS build
https://hub.docker.com/_/microsoft-dotnet-core-sdk/
image

@spriet2000
Copy link

spriet2000 commented Jun 7, 2020

Similar here. Builds on local Mac, but in Docker the same error message.
netcoreapp3.1

Works with..
FROM mcr.microsoft.com/dotnet/core/sdk:3.1.100-buster AS build

@davidfowl
Copy link
Member

cc @richlander @MichaelSimons

@MichaelSimons
Copy link
Member

cc @mthalman

@mthalman
Copy link
Member

mthalman commented Jun 8, 2020

Can someone provide a current repro for this? I'm unable to get my own repro on either my Windows or Mac machine. Please provide the following:

  • A simple .NET project and accompanying Dockerfile
  • The digest of the SDK image being used: docker inspect -f "{{ index .RepoDigests 0 }}" mcr.microsoft.com/dotnet/core/sdk:3.1
  • Output of docker version
  • Output of docker info

@Mousaka
Copy link

Mousaka commented Jul 1, 2020

Running

docker-compose up --force-recreate --build -d my-service

made it start working again for me. I'm not sure what the corresponding docker-command is.

@vms20591
Copy link

vms20591 commented Sep 4, 2020

Any updates on this issue?

Following dotnet --info is from my local system

.NET Core SDK (reflecting any global.json):
 Version:   3.1.401
 Commit:    39d17847db

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.401/

Host (useful for support):
  Version: 3.1.7
  Commit:  fcfdef8d6b

.NET Core SDKs installed:
  2.1.809 [/usr/share/dotnet/sdk]
  3.1.401 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Following is from mcr.microsoft.com/dotnet/core/sdk:2.1 docker image

.NET Core SDK (reflecting any global.json):
 Version:   2.1.809
 Commit:    d660ed81be

Runtime Environment:
 OS Name:     debian
 OS Version:  9
 OS Platform: Linux
 RID:         debian.9-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.809/

Host (useful for support):
  Version: 2.1.21
  Commit:  bb155063c5

.NET Core SDKs installed:
  2.1.809 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

You can see that both my local setup & docker have same version of .net core 2.1. Everything builds just fine on my local system. I even tried .net core 2.2 version of the docker image and it gives me the same error as OP.

.net core 2.2 image:
--------------------------

/usr/share/dotnet/sdk/2.2.207/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error NETSDK1064: Package AWSSDK.S3, version 3.3.110.72 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.

.net core 2.1 image:
--------------------------

/usr/share/dotnet/sdk/2.1.809/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package AWSSDK.S3, version 3.3.110.72 was not found. It mig
ht have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.

I even tried 3.1.100-buster image and I get this error,

/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018: The "ResolvePackageAssets" task failed unexpectedly. [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018: NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder '/usr/share/dotnet/sdk/NuGetF allbackFolder'. [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at NuGet.Packaging.FallbackPackagePathResolver..ctor(String userPackageFolder, IEnumerable`1 fallbackPackageFolders) [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver(IEnumerable`1 packageFolders) [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver(LockFile lockFile) [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task) [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash) [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task) [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups() [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore() [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/source/myapp/myapp.csproj]
/usr/share/dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/source/myapp/myapp.csproj]

Thanks.

@simonz130
Copy link

I just tried to build docker image on macos from the following:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1.300-alpine as builder
WORKDIR /app
COPY *.csproj .

and get an error:

/usr/share/dotnet/sdk/3.1.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1064: Package CommandLineParser, version 2.8.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [/app/cart_grpc.csproj]
The command '/bin/sh -c dotnet publish -c Release -o cart_out --no-restore' returned a non-zero code: 1

Building locally on macos succeeds. Any clues?

@scott-nelson-olo
Copy link

I was seeing this error consistently with mcr.microsoft.com/dotnet/sdk:3.1-alpine when RUN dotnet publish:

#30 5.356 /usr/share/dotnet/sdk/3.1.406/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1064: Package AWSSDK.S3, version 3.3.104.17 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [****]

I removed the bin and obj folders from the host (that had been populated when built with VS 2019) and saw that it fixed it! So added a .dockerignore with the following and am good now:

**/bin
**/obj

@houssem11957
Copy link

houssem11957 commented Jun 28, 2022

i faced the same issue with mcr.microsoft.com/dotnet/sdk:5.0-buster-slim
but with ignoring restore while building and publishing , on the other hand when i retore the app when building it works , removed the --no-restore option then it worked ... wondering what is happening ....

@richlander
Copy link
Member

Can you share the commands you have in your Dockerfile?

@jsonarso
Copy link

I have just encountered this same problem when trying to build an image using mcr.microsoft.com/dotnet/sdk:6.0

Device details:

  • Intel Macbook Pro (Ventura 13.3.1)
  • Docker 4.19.0.

I'm executing dotnet restore as a separate step (which is completing successfully) and then dotnet publish --no-restore is failing with the following error:

error NETSDK1064: Package Microsoft.EntityFrameworkCore.Analyzers, version 6.0.9 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.

I tried removing the --no-restore flag from the publish command as @houssem11957 mentioned, and it actually worked.

NOTE: I have no errors when building the image using my Surface Pro8 (Windows).

@TripleEmcoder
Copy link

TripleEmcoder commented Jun 22, 2023

I just came here with apparently the same problem, but happening both on Windows and Linux at the same time. I couldn't really believe that this would just start happening at random. Turned out we had a change of the context directory of our Dockerfile and forgot to move .dockerignore. My guess is that obj contents with package restore temp files from the host started leaking into the Docker context and breaking the build seemingly randomly. So double check your .dockerignores.

@tmaurst
Copy link

tmaurst commented Apr 7, 2024

I just came here with apparently the same problem, but happening both on Windows and Linux at the same time. I couldn't really believe that this would just start happening at random. Turned out we had a change of the context directory of our Dockerfile and forgot to move .dockerignore. My guess is that obj contents with package restore temp files from the host started leaking into the Docker context and breaking the build seemingly randomly. So double check your .dockerignores.

@TripleEmcoder Thanks for the tip, this was my problem. I had done some shuffling of projects and misplaced a .dockerignore file. Corrected that and the error went away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests