"az acr build" failed, but "docker build" successful with the same source
See original GitHub issue[Enter feedback here]
Issue: “az acr build” failed, but “docker build” successful with the same source
Errors:
Step 11/16 : RUN dotnet publish --no-restore -c Release -o /app
—> Running in 3162c0aeebfc
Microsoft ® Build Engine version 16.11.2+f32259642 for .NET
Copyright © Microsoft Corporation. All rights reserved.
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: The “ResolvePackageAssets” task failed unexpectedly. [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: NuGet.Packaging.Core.PackagingException : Unable to find fallback package folder ‘C:\Program Files\dotnet\sdk\NuGetFallbackFolder’. [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at NuGet.Packaging.FallbackPackagePa thResolver…ctor(String userPackageFolder, IEnumerable1 fallbackPackageFolders) [/src/Api/Api.csproj] /usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.NET.Build.Tasks.NuGetPa ckageResolver..ctor(String userPackageFolder, IEnumerable
1 fallbackPackageFolders) [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.NET.Build.Tasks.NuGetPa ckageResolver.CreateResolver(IEnumerable`1 packageFolders) [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.NET.Build.Tasks.NuGetPa ckageResolver.CreateResolver(LockFile lockFile) [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.NET.Build.Tasks.Resolve PackageAssets.CacheWriter…ctor(ResolvePackageAssets task) [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.NET.Build.Tasks.Resolve PackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash) [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.NET.Build.Tasks.Resolve PackageAssets.CacheReader…ctor(ResolvePackageAssets task) [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.NET.Build.Tasks.Resolve PackageAssets.ReadItemGroups() [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.NET.Build.Tasks.Resolve PackageAssets.ExecuteCore() [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBas e.Execute() [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecu tionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/src/Api/Api.csproj]
/usr/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuild er.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExec uteTask) [/src/Api/Api.csproj]
The command ‘/bin/sh -c dotnet publish --no-restore -c Release -o /app’ returned a non-zero code: 1
2021/11/18 12:36:42 Container failed during run: build. No retries remaining.
failed to run step ID: build: exit status 1
Run ID: fb1 failed after 29s. Error: failed during run, err: exit status 1 Run failed
(Please refer to the attached ‘az_acr_build_failures.txt’ for details. )
root@philUbuntu1804:~/AzureAcrContainer/src# az version { “azure-cli”: “2.22.0”, “azure-cli-core”: “2.22.0”, “azure-cli-telemetry”: “1.0.6”, “extensions”: {} }
How to reproduce it:
- Decompress the attached package ‘AzureAcrContainer.zip’ and upload to your Linux machine with az cli installed.
- Run command as below: az cloud set -n AzureChinaCloud az login az acr login -n “‘your azure container registry’”
cd ~/AzureAcrContainer/src az acr build --registry “‘your azure container registry’” --file Dockerfile --image ssmr/api-test:0.1.8 ./ You will see the errors pasted above and also attached.
Comparison test:
- docker build -t aa:v1.1 ./ It executes successfully without any errors.
- Delete ‘–no-restore’ option in Dockerfile, and then run ‘az acr build --registry “‘your azure container registry’” --file Dockerfile --image ssmr/api-test:0.1.8 ./’.
It will also successful without any errors.
Please PG help check:
- Why does the az acr build failure occur? (Also tried on az ali 2.30.0, it also failed. )
- Please tell the difference between ‘az acr build’ and ‘docker build’ in underlying mechanisms.
Document Details
AzureAcrContainer.zip az_acr_build_failures.txt
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: c608162e-cf40-9d53-da4a-51f51a0311ea
- Version Independent ID: eccbb543-be68-7de2-d41d-abee55c81452
- Content: az acr
- Content Source: latest/docs-ref-autogen/acr.yml
- Service: container-registry
- GitHub Login: @rloutlaw
- Microsoft Alias: routlaw
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (2 by maintainers)
Get reply from @northtyphoon : ‘az acr build’ doesn’t support trailing slash in the ignore. It’ s just the restriction of ‘az acr build’.
Thanks.
Hi @huanwu and @northtyphoon ,
Thank you both help on this issue.
In my opinion, there should be no difference between ‘/bin/’ and '/bin’.
May I know what is the reason of the solution, just the difference between ‘/bin/’ and '/bin’ in this issue here?
Thanks.