question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"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, 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.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:

  1. Decompress the attached package ‘AzureAcrContainer.zip’ and upload to your Linux machine with az cli installed.
  2. 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:

  1. docker build -t aa:v1.1 ./ It executes successfully without any errors.
  2. 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 ./’. image

It will also successful without any errors.

Please PG help check:

  1. Why does the az acr build failure occur? (Also tried on az ali 2.30.0, it also failed. )
  2. 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:open
  • Created 2 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
caiwan-msftcommented, Nov 30, 2021

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.

0reactions
caiwan-msftcommented, Nov 30, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Powershell to trigger ACR BUILD failing when called from ...
The problem was that the ACR BUILD command needed an absolute file path for the docker file and also <SOURCE_LOCATION>. When called from...
Read more >
Tutorial - Quick container image build - Azure Container Registry
In this tutorial, you learn how to build a Docker container image in Azure with Azure Container Registry Tasks (ACR Tasks), then deploy...
Read more >
How to Fix and Debug Docker Containers Like a Superhero
While containers help developers rapidly build and run cross-platform applications, creating error-free apps remains a constant challenge.
Read more >
Create and Push a Docker Image to Azure Container Registry
docker -compose up --build ... az acr create --resource-group jonnychipz-acr-rg --name jonnychipzacr001 --sku Basic ...
Read more >
Deploying a Docker based web application to Azure App ...
Build custom Docker images using Azure DevOps Hosted Linux agent. Push and ... az acr create -n <unique-acr-name> -g DockerRG --sku Standard ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found