Skip to content

Commit 391a0e4

Browse files
committed
Merge the duplicate PRs
This merges content from #598 into the original PR.
1 parent 3eb29f9 commit 391a0e4

1 file changed

Lines changed: 177 additions & 13 deletions

File tree

src/content/docs/azure/services/container-registry.mdx

Lines changed: 177 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
2-
title: "Container Registry"
2+
title: 'Container Registry'
33
description: Get started with Azure Container Registry on LocalStack
44
template: doc
55
---
66

7-
import AzureFeatureCoverage from "../../../../components/feature-coverage/AzureFeatureCoverage";
7+
import AzureFeatureCoverage from '../../../../components/feature-coverage/AzureFeatureCoverage';
88

99
## Introduction
1010

11-
Azure Container Registry is a managed registry for storing and managing container images and related OCI artifacts.
12-
It helps you keep container images close to your deployments while controlling access and registry policies.
13-
Container Registry is commonly used as the private image source for containerized applications and CI/CD workflows. For more information, see [Azure Container Registry documentation](https://learn.microsoft.com/en-us/azure/container-registry/).
11+
Azure Container Registry (ACR) is a managed, private OCI-compatible registry for storing and managing container images and Helm charts.
12+
It integrates natively with Azure Kubernetes Service, Azure Container Instances, and Azure App Service to streamline container-based application deployments.
13+
ACR is commonly used to build, store, and manage container images as part of a continuous integration and deployment pipeline. For more information, see [Azure Container Registry documentation](https://learn.microsoft.com/en-us/azure/container-registry/).
1414

1515
LocalStack for Azure provides a local environment for building and testing applications that make use of Azure Container Registry.
1616
The supported APIs are available on our [API Coverage section](#api-coverage), which provides information on the extent of Container Registry's integration with LocalStack.
1717

1818
## Getting started
1919

20-
This guide is designed for users new to Container Registry and assumes basic knowledge of the Azure CLI and our `azlocal` wrapper script.
20+
This guide walks you through creating a registry, logging in with Docker, pushing an image, and listing repositories. It assumes basic knowledge of the Azure CLI and our `azlocal` wrapper script.
2121

2222
Launch LocalStack using your preferred method. For more information, see [Introduction to LocalStack for Azure](/azure/getting-started/). Once the container is running, enable Azure CLI interception by running:
2323

@@ -58,18 +58,20 @@ az group create \
5858

5959
### Create a container registry
6060

61-
Create a Basic SKU registry in the resource group:
61+
Create a Basic-tier Azure Container Registry:
6262

6363
```bash
6464
az acr create \
6565
--name acrdoc89 \
6666
--resource-group rg-acr-demo \
6767
--location westeurope \
68-
--sku Basic
68+
--sku Basic \
69+
--admin-enabled true
6970
```
7071

7172
```bash title="Output"
7273
{
74+
"adminUserEnabled": true,
7375
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-acr-demo/providers/Microsoft.ContainerRegistry/registries/acrdoc89",
7476
"location": "westeurope",
7577
"name": "acrdoc89",
@@ -83,7 +85,55 @@ az acr create \
8385
}
8486
```
8587

86-
Get and list registries:
88+
### Log in with Docker
89+
90+
Authenticate the local Docker daemon to the registry using the Azure CLI:
91+
92+
```bash
93+
az acr login --name acrdoc89
94+
```
95+
96+
The emulator does not issue an AAD challenge, so the CLI prints an informational warning before confirming `Login Succeeded`. This is expected behaviour.
97+
98+
### Build and push an image
99+
100+
Create a minimal `Dockerfile` for the demo image:
101+
102+
```bash
103+
cat > Dockerfile <<'EOF'
104+
FROM alpine:latest
105+
CMD ["echo", "Hello from LocalStack ACR!"]
106+
EOF
107+
```
108+
109+
Capture the registry login server returned by the emulator, then build and push the image using that address:
110+
111+
```bash
112+
LOGIN_SERVER=$(az acr show --name acrdoc89 --resource-group rg-acr-demo --query loginServer -o tsv)
113+
docker build -t $LOGIN_SERVER/hello:v1 .
114+
docker push $LOGIN_SERVER/hello:v1
115+
```
116+
117+
Alternatively build directly within the emulated registry:
118+
119+
```bash
120+
az acr build \
121+
--image hello:v1 \
122+
--registry acrdoc89 \
123+
.
124+
```
125+
126+
### Pull an image
127+
128+
Pull the image back from the registry to confirm it was pushed correctly:
129+
130+
```bash
131+
docker pull $LOGIN_SERVER/hello:v1
132+
```
133+
134+
### Show and list registries
135+
136+
Get details for one registry and list all registries in the resource group:
87137

88138
```bash
89139
az acr show \
@@ -94,14 +144,19 @@ az acr list \
94144
--resource-group rg-acr-demo
95145
```
96146

97-
```bash title="Output"
147+
`az acr show` returns a single registry object; `az acr list` returns an array. Example fragments:
148+
149+
```bash title="Output (az acr show)"
98150
{
99151
"name": "acrdoc89",
100152
"loginServer": "acrdoc89.azurecr.azure.localhost.localstack.cloud:4566",
101-
"adminUserEnabled": false,
153+
"adminUserEnabled": true,
102154
"provisioningState": "Succeeded",
103155
...
104156
}
157+
```
158+
159+
```bash title="Output (az acr list)"
105160
[
106161
{
107162
"name": "acrdoc89",
@@ -112,9 +167,82 @@ az acr list \
112167
]
113168
```
114169

115-
### Enable admin user and view credentials
170+
### List image repositories
171+
172+
List repositories (image names) in the registry—for example, after you push an image in [Build and push an image](#build-and-push-an-image), the repository name (without a tag) appears here:
173+
174+
```bash
175+
az acr repository list \
176+
--name acrdoc89 \
177+
--output table
178+
```
179+
180+
```text title="Output"
181+
Name
182+
---------------
183+
hello
184+
```
116185

117-
Enable the admin user on the registry:
186+
### Check name availability
187+
188+
Registry names are globally unique in Azure. The following example shows the result when the name is already in use (for example, after you have created the registry):
189+
190+
```bash
191+
az acr check-name --name acrdoc89
192+
```
193+
194+
```bash title="Output"
195+
{
196+
"message": "The registry acrdoc89 is already in use.",
197+
"nameAvailable": false,
198+
"reason": "AlreadyExists"
199+
}
200+
```
201+
202+
### Update registry settings
203+
204+
Turn off the registry admin user (for example, to rely on other auth modes in your workflow):
205+
206+
```bash
207+
az acr update --name acrdoc89 --resource-group rg-acr-demo --admin-enabled false
208+
```
209+
210+
```bash title="Output"
211+
{
212+
"adminUserEnabled": false,
213+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-acr-demo/providers/Microsoft.ContainerRegistry/registries/acrdoc89",
214+
"loginServer": "acrdoc89.azurecr.azure.localhost.localstack.cloud:4566",
215+
"name": "acrdoc89",
216+
"provisioningState": "Succeeded",
217+
"resourceGroup": "rg-acr-demo",
218+
"sku": { "name": "Basic", "tier": "Basic" },
219+
"type": "Microsoft.ContainerRegistry/registries"
220+
...
221+
}
222+
```
223+
224+
## Show registry usage
225+
226+
Show current storage usage statistics for the registry:
227+
228+
```bash
229+
az acr show-usage --name acrdoc89 --resource-group rg-acr-demo
230+
```
231+
232+
```bash title="Output"
233+
{
234+
"value": [
235+
{ "currentValue": 0, "limit": 10737418240, "name": "Size", "unit": "Bytes" },
236+
{ "currentValue": 0, "limit": 2, "name": "Webhooks", "unit": "Count" },
237+
{ "currentValue": 0, "limit": 100, "name": "ScopeMaps", "unit": "Count" },
238+
{ "currentValue": 0, "limit": 100, "name": "Tokens", "unit": "Count" }
239+
]
240+
}
241+
```
242+
243+
## Enable admin user and view credentials
244+
245+
Re-enable the admin user on the registry (for example, after you disabled it in [Update registry settings](#update-registry-settings)), so you can retrieve admin credentials:
118246
119247
```bash
120248
az acr update \
@@ -156,6 +284,42 @@ az acr credential show \
156284
}
157285
```
158286
287+
## Delete and verify
288+
289+
Delete the registry and remove the demo `Dockerfile` created earlier:
290+
291+
```bash
292+
az acr delete --name acrdoc89 --resource-group rg-acr-demo --yes
293+
rm -f Dockerfile
294+
```
295+
296+
## Features
297+
298+
- **Full CRUD lifecycle:** Create, read, update, and delete registry resources using the Azure CLI or ARM API.
299+
- **Admin user management:** Enable or disable admin user access and retrieve admin credentials.
300+
- **Name availability check:** Validate registry name uniqueness via `az acr check-name`.
301+
- **Image push and pull:** Push and pull OCI-compliant container images using the standard Docker CLI.
302+
- **In-registry builds:** Build images directly in the emulated registry using `az acr build`.
303+
- **Repository listing:** List repositories and image tags stored in the registry.
304+
- **Registry usage reporting:** Retrieve storage and limit usage via `az acr show-usage`.
305+
- **Registry update:** Modify registry properties such as admin enabled and SKU.
306+
- **Multiple SKUs accepted:** Basic, Standard, and Premium SKU names are accepted (all backed by the same local registry).
307+
308+
## Limitations
309+
310+
- **Geo-replication not supported:** Multi-region registry replication is not emulated.
311+
- **ACR Tasks beyond basic build:** Task scheduling, triggers, and multi-step task workflows are mocked at the ARM level but not executed.
312+
- **Private endpoints for ACR:** Private Link–based network isolation is not supported.
313+
- **Webhook notifications:** Registry webhooks defined via the ARM API are stored but not fired on push events.
314+
- **Content trust and quarantine:** Image signing and quarantine policies are not enforced.
315+
- **Delete is not persisted:** `az acr delete` returns HTTP 200 and exits cleanly, but the registry record is not removed from the in-memory store in the current emulator version.
316+
317+
## Samples
318+
319+
The following sample demonstrates how to use Azure Container Registry with LocalStack for Azure:
320+
321+
- [Azure Container Instances, Key Vault, and Storage](https://github.com/localstack/localstack-azure-samples/blob/main/samples/aci-blob-storage/python/README.md)
322+
159323
## API Coverage
160324
161325
<AzureFeatureCoverage service="Microsoft.ContainerRegistry" client:load />

0 commit comments

Comments
 (0)