Az / List Images Within Registry
List Images Within Registry
Lists all repositories within a specified Azure Container Registry (ACR).
az acr repository list -n <registry_name> --output table az acr repository list -n <registry_name> --output table #!/bin/bash
# List Images Within Registry
az acr repository list {{[-n|--name]}} {{registry_name}} --output table import subprocess
# List Images Within Registry
# Make sure to replace <placeholders> with actual values
def run_command():
cmd = [
"az",
"acr",
"repository",
"list",
"-n",
"<registry_name>",
"--output",
"table"
]
try:
print(f"Executing: {' '.join(cmd)}")
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"Error: {e}")
except FileNotFoundError:
print("Error: az not found. Please install it first.")
if __name__ == "__main__":
run_command() When To Use
When assessing the stored images and ensuring compliance with image retention policies.
Pro Tip
Utilize the --output json to handle results programmatically for automation.
Command Builder
Tune the command before you copy it
az acr repository list -n <registry_name> --output table Terminal Output
Expected runtime feedback
| Repository Name |
|-----------------------|
| my-app |
| web-service |
| database-service |
| frontend |
| backend | Anatomy of Output
Understanding the result
Repositories: image1, image2, sample-repo Available Repositories Each repository represents a different container image stored.
TotalRepositories: 3 Count of Repositories Indicates the total number of repositories in the ACR.
Troubleshooting
Common pitfalls
Error: NotFoundException -- Registry 'myRegistry' does not exist.
Solution: Double-check the registry name provided.
Error: InvalidResourceGroupException -- Resource group not specified or invalid.
Solution: Provide valid resource group context if not default.
Error: AccessDeniedException -- User is not authorized to perform this operation.
Solution: Ensure your user has the necessary permissions on the ACR.
Command Breakdown
What each part is doing
-
az - Base Command
- The executable that performs this operation. Here it runs Az before the shell applies any redirect operators.
-
-n - n| name
- The value supplied for n| name.
-
<registry_name> - registry name
- The value supplied for registry name.
-
-n - Command Option
- Tool-specific option used by this command invocation.
-
--output - Command Option
- Tool-specific option used by this command invocation.
How To Run
Execution path
- Step 1
Run `az acr repository list -n <registry_name> --output table` to list images.
- Step 2
Verify the output displays repositories in a formatted table.
Alternative Approaches
Comparable commands in other tools
Alternative containers tools for the same job.
aws ecr list-images --repository-name <repository> Colima / List Containers Status colima list Crane / Set Address To Listen On crane registry serve --address <address_name> Systemd Dissect / Show Image Information Linux systemd-dissect <path/to/image.raw> Systemd Dissect / List Files In Image Linux systemd-dissect -l <path/to/image.raw>