How to debug "az acr build ..." error

lili zhang 150 Reputation points
2025-10-27T01:27:27.7133333+00:00

Dear Sir/Madam,

I am testing the reference implementation of "aks-fabrikam-dronedelivery" part9 "workload.md"

and from azurecli did the following:

......

"az acr build -r $ACR_NAME -t $ACR_SERVER/delivery:0.1.0 ./src/shipping/delivery/."

then got the error message saying "./src/shipping/delivery/. does not exist" shown as the picture.

Please advise me on how to get this path of "./src/shipping/delivery/." az_acr_build_error.JPG ?

Thanks,

Lili

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Ankit Yadav 6,345 Reputation points Microsoft External Staff Moderator
    2025-10-27T03:00:25.0433333+00:00

    Hello @lili zhang

    Hope you are doing good!

    The error means that the path ./src/shipping/delivery/. does not exist in your current directory. Based on the command, you should expect this folder structure:- src->shipping->delivery->Dockerfile

    Can you do a quick check if the folder actually exists?

    1. Check if there's any directory named shipping or delivery:
    # Check your current location
    pwd
    # List the directory structure
    ls -la
    # Check if the shipping directory exists
    find . -name "shipping" -type d
    
    1. If you can find the folder exists and the Dockerfile exists as expected but still the error throws up maybe you could try below formats of the command as well to see if it works out.
    # If you're in the root of the repository, try:
    az acr build -r $ACR_NAME -t $ACR_SERVER/delivery:0.1.0 ./src/shipping/delivery
    
    # Or if you're in a different location, navigate to the root first, then try below command:
    az acr build -r $ACR_NAME -t $ACR_SERVER/delivery:0.1.0 ./src/shipping/delivery
    
    
    # Relative path without trailing dot
    az acr build -r $ACR_NAME -t $ACR_SERVER/delivery:0.1.0 src/shipping/delivery
    
    # Or use absolute path
    az acr build -r $ACR_NAME -t $ACR_SERVER/delivery:0.1.0 $(pwd)/src/shipping/delivery
    
    1. Worst case, you can try creating the file manually and see if the command works out for you.
    git clone <repo-link.git>
    

    Additionally, I've asked few subscription related details in the Private Message, kindly check and answer them so that I can assist you better way.

    1 person found this answer helpful.
    0 comments No comments

Answer accepted by question author
  1. Jerald Felix 9,840 Reputation points
    2025-10-27T02:21:27.0133333+00:00

    Hello lili zhang,

    Thanks for sharing the details on your az acr build error while working through the AKS Fabrikam Drone Delivery reference implementation (part 9, workload.md)—that's a solid hands-on lab for learning Azure Container Registry (ACR) and Kubernetes deployments, and path resolution issues like "./src/shipping/delivery/." not existing are super common when running CLI commands from the wrong context or with incomplete repo setups. As a Microsoft Certified Trainer with Azure AI and DevOps experience, I've guided many through this exact sample, and the error typically boils down to the current working directory, missing cloned files, or a subtle syntax quirk in the command. I'll explain why it's failing and how to debug/fix it step by step, drawing from the updated AKS docs and CLI behaviors as of October 2025.

    Understanding the Error

    The message "./src/shipping/delivery/. does not exist" means the Azure CLI can't locate the build context path when pushing your Dockerfile and source to ACR. In az acr build, the final argument specifies the local directory to use as the build root (containing the Dockerfile and app files)—it resolves relative to your current shell location. If you're running the command from the repo's root (e.g., /path/to/aks-fabrikam-dronedelivery), ./src/shipping/delivery/. should point to the delivery service's folder, but the trailing "." might confuse the parser or indicate a deeper issue like:

    • Wrong Directory: You're not in the cloned repo root, so ./src/... 404s.
    • Incomplete Clone: Git didn't pull all submodules or files (the repo has multiple services like shipping/delivery).
    • Path Syntax: The trailing "." is valid (it includes the current dir), but if the folder lacks a Dockerfile, ACR skips with this error.
    • Permissions/Environment: Running in a restricted shell (e.g., Azure Cloud Shell without mounted storage) or with case-sensitive path mismatches on Linux.

    From recent GitHub issues on the AKS samples repo (updated September 2025), this pops up if the git clone missed branches or if users skip the cd into the project folder. It's not an ACR bug but a local setup hiccup—ACR itself is healthy per Azure Status.

    Step-by-Step Debugging and Resolution

    Let's verify your setup and rebuild successfully. Assume you're on a Linux/macOS terminal or Azure CLI (v2.60+); adjust for Windows PowerShell.

    1. Check Your Current Location and Repo Structure:
      • Run pwd (or cd on Windows) to confirm you're in the cloned repo root, e.g., /home/user/aks-fabrikam-dronedelivery.
      • List the directory: ls -la (or dir on Windows). You should see folders like src/, docs/, and README.md.
      • Drill down: ls src/shipping/—it should show delivery/ with contents like Dockerfile, src/, and tests/.
      • If src/shipping/delivery/ is missing or empty:
        • Re-clone the repo: rm -rf aks-fabrikam-dronedelivery && git clone https://github.com/Azure-Samples/aks-fabrikam-dronedelivery.git && cd aks-fabrikam-dronedelivery.
        • Pull latest: git checkout main && git pull origin main. The sample uses the main branch; avoid master if outdated.
        • Verify submodules (if any): git submodule update --init --recursive.
    2. Navigate and Validate the Build Path:
      • Change to the repo root: cd aks-fabrikam-dronedelivery (or wherever you cloned it).
      • Inspect the target: ls -la src/shipping/delivery/. Key files needed:
        • Dockerfile (builds the .NET Core delivery service).
        • App source in src/shipping/delivery/src/.
        • If missing, the path is invalid—double-check the lab instructions in workload.md for the exact service (it's under shipping for delivery logic).
      • Test path resolution: realpath ./src/shipping/delivery/. (or echo $PWD/src/shipping/delivery/. on Windows). This should output a full path like /home/user/aks-fabrikam-dronedelivery/src/shipping/delivery/..
      • Pro Tip: If using Azure Cloud Shell, mount your repo via Git or VS Code extension to avoid path issues.
    3. Run the Build with Verbose Logging:
      • Set variables first (as in the lab):
        
             ACR_NAME="youracrname"  # From az acr create or existing
        
             ACR_SERVER="$ACR_NAME.azurecr.io"  # e.g., fabrikamacr.azurecr.io
        
             echo "ACR Server: $ACR_SERVER"
        
             az acr login --name $ACR_NAME  # Authenticate first
        
        
      • Execute with debug flags: az acr build -r $ACR_NAME -t $ACR_SERVER/delivery:0.1.0 --verbose ./src/shipping/delivery/.
        • --verbose (or -v) outputs step-by-step logs, showing if it finds the Dockerfile, runs docker build, and pushes layers.
        • If still "does not exist," drop the trailing ".": az acr build -r $ACR_NAME -t $ACR_SERVER/delivery:0.1.0 ./src/shipping/delivery
      • Expected Output: It should detect the context, build (e.g., "STEP 1: FROM mcr.microsoft.com/dotnet/aspnet:6.0"), tag as delivery:0.1.0, and push to ACR. Takes 2-5 minutes.
    4. Common Fixes if It Persists:
      • Path Adjustment: The lab might have updated—check workload.md for the exact command. If the delivery service is in a different spot (e.g., ./src/services/delivery/), update accordingly. Browse the GitHub repo online to confirm: https://github.com/Azure-Samples/aks-fabrikam-dronedelivery/tree/main/src/shipping/delivery.
      • Dockerfile Issues: Ensure Dockerfile exists and is valid (no syntax errors). Test locally: cd src/shipping/delivery && docker build -t test-delivery .—if it fails, fix the Dockerfile (common: wrong base image or COPY paths).
      • ACR Permissions: Run az acr show --name $ACR_NAME --query "loginServer" to confirm setup. For AKS integration, ensure your ACR is attached: az aks update -n yourakscluster -g yourrg --attach-acr $ACR_NAME.
      • CLI Version/Env: Update CLI: az upgrade. If on Windows, use Git Bash for Unix-like paths. For macOS, ensure Docker Desktop is running (ACR build uses local Docker daemon).
      • Alternative Build: Use az acr build --file Dockerfile -r $ACR_NAME ./src/shipping/delivery to specify the Dockerfile explicitly.
    5. Debugging Tools for Deeper Insight:
      • ACR Tasks Logs: After a failed build, query: az acr build show -r $ACR_NAME -t delivery:0.1.0 --output table. Or use portal: ACR > Services > Build logs to view runs.
      • Local Docker Test: Mimic ACR: docker build -t local/delivery:0.1.0 ./src/shipping/delivery/.—pushes errors to stdout.
      • Environment Vars: Echo vars: echo "Current dir: $(pwd), Path exists: $([ -d ./src/shipping/delivery ] && echo yes || echo no)".
      • If in a pipeline (e.g., Azure DevOps), check agent logs for checkout steps.

    Next Steps in the Lab

    Once built, proceed to deploy: kubectl apply -f ./aks-deployment.yaml (or similar in workload.md), then verify with az acr repository show-tags -n $ACR_NAME -r delivery --orderby time_desc. The full AKS-Fabrikam sample teaches CI/CD with ACR, so nailing the build unblocks Kubernetes manifests for the drone delivery backend.

    This should get your image building and pushed—it's usually a quick path tweak. If you share your current pwd output, the exact error screenshot details, or the repo branch you're on, I can pinpoint it further. Keep at it; these labs are gold for AKS cert prep!

    Best Regards,

    Jerald Felix

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.