Skip to content

If the docker file contains a base image from a private acr, then the az acr build will failed with authentication issue.  #774

@JohnTangZX

Description

@JohnTangZX

Describe the bug
I have a base image that is in one ACR, now I want to build another image using the base image and push it to another ACR using az acr build. It failed with authentication issue.

To Reproduce
Steps to reproduce the behavior:

  1. Push the hello-world image to the ACR "srcacr".
  2. Create a docker file with "FROM srcacr.azurecr.cn/sample/hello-world:v1"
  3. Run the az acr build command below.

az acr build --image sample/hello-world:v2 --registry dstacr --file Dockerfile2 .

  1. It will report the below error:

Packing source code into tar to upload...
Uploading archived source code from '/tmp/build_archive_8f5e281042644ed28cc90939d6a6a1b5.tar.gz'...
Sending context (501.000 Bytes) to registry: dstacr...
Queued a build with ID: fd7
Waiting for an agent...
2024/08/15 08:37:27 Downloading source code...
2024/08/15 08:37:28 Finished downloading source code
2024/08/15 08:37:28 Using acb_vol_9ad152d3-dfb8-42d1-ab57-7a7e0debc19d as the home volume
2024/08/15 08:37:28 Setting up Docker configuration...
2024/08/15 08:37:29 Successfully set up Docker configuration
2024/08/15 08:37:29 Logging in to registry: dstacr.azurecr.cn
2024/08/15 08:37:29 Successfully logged into dstacr.azurecr.cn
2024/08/15 08:37:29 Executing step ID: build. Timeout(sec): 28800, Working directory: '', Network: ''
2024/08/15 08:37:29 Scanning for dependencies...
2024/08/15 08:37:30 Successfully scanned dependencies
2024/08/15 08:37:30 Launching container with name: build
Sending build context to Docker daemon 7.168kB
Step 1/1 : FROM srcacr.azurecr.cn/sample/hello-world:v1
Head "https://srcacr.azurecr.cn/v2/sample/hello-world/manifests/v1": unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.
2024/08/15 08:37:30 Container failed during run: build. No retries remaining.
failed to run step ID: build: exit status 1

Run ID: fd7 failed after 3s. Error: failed during run, err: exit status 1
Run failed

Expected behavior
It should success.

Screenshots
If applicable, add screenshots to help explain your problem.

Any relevant environment information

  • OS: Centos
  • Azure CLI/PowerShell/SDK version: 2.38.1
  • Docker version
  • Datetime (UTC) when the issue occurred
  • Registry and image names

Additional context
Add any other context about the problem here.

If any information is a concern to post here, you can create a support ticket or send an email to acrsup@microsoft.com.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugFeature bugs that should be fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions