Skip to content

Docker build needs platform parameter defined #9

@Jandev

Description

@Jandev

The Container Registry likes to have a linux/amd64 image.
However, when running the scripts on a Macbook it gets build with the linux/arm64 platform by default resulting in the following error:

Updating Container App with new image...
- Running ..ERROR: Failed to provision revision for container app 'ca-web-grb345qzdhluq'. Error details: The following field(s) are either invalid or missing. Field 'template.containers.ca-web-grb345qzdhluq.image' is invalid with details: 'Invalid value: "crgrb345qzdhluq.azurecr.io/ai-foundry-agent/web-dev:azd-deploy-1764155623": image OS/Arc must be linux/amd64 but found linux/arm64';..
Write-Error: Container deployment failed: Container app update failed

I've added the --platform parameter in the build-and-deploy-container.ps1 file to fix this issue.

$dockerfilePath = Join-Path "deployment" "docker" "frontend.Dockerfile"
docker build `
    --platform linux/amd64 `
    --build-arg ENTRA_SPA_CLIENT_ID=$ClientId `
    --build-arg ENTRA_TENANT_ID=$TenantId `
    -f $dockerfilePath `
    -t $imageName `
    . 2>&1 | Out-Host

$buildOutput = az acr build `
    --registry $AcrName `
    --image "ai-foundry-agent/web-dev:$imageTag" `
    --platform linux/amd64 `
    --build-arg ENTRA_SPA_CLIENT_ID=$ClientId `
    --build-arg ENTRA_TENANT_ID=$TenantId `
    --file $dockerfilePath `
    --no-logs `
    . 2>&1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions