Import Container Images to Azure ACR
Cache images in ACR
Prerequisites
Before we dive into the steps, make sure you have the following:
- An Azure account with permissions to create and manage container registries
- The Azure CLI installed and configured with your Azure credentials
Import images from Docker Hub
The az acr import
command allows you to copy container images from an external registry to your Azure Container Registry without needing to pull and push the image manually. Here's the basic syntax:
az acr import \
--name <registry_name> \
--source <image_source_url> \
--image <target_image_name>
Where:
<registry_name>
: The name of your Azure Container Registry<image_source_url>
: The URL of the image you want to import (e.g., docker.io/library/hello-world:latest)<target_image_name>
: The name you want to give the imported image in your ACR
Example:
az acr import \
--name acr \
--source docker.io/library/hello-world:latest \
--image library/hello-world:latest
Troubleshooting
Invalid message TooManyRequests Too Many Requests
{
"code": "TOOMANYREQUESTS",
"message": "You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit"
}
Solution
Login to Docker Hub
az acr import \
--name <registry_name> \
--source <image_source_url> \
--image <target_image_name> \
--username <username> \
--password <password>
Where:
<registry_name>
: The name of your Azure Container Registry<image_source_url>
: The URL of the image you want to import (e.g., docker.io/library/hello-world:latest)<target_image_name>
: The name you want to give the imported image in your ACR<username>
: The username for Docker Hub<password>
: The password for Docker Hub