{"id":23867826,"url":"https://github.com/lazauk/acr-protectedstorage-cli","last_synced_at":"2026-05-17T02:03:05.341Z","repository":{"id":270399505,"uuid":"865876240","full_name":"LazaUK/ACR-ProtectedStorage-CLI","owner":"LazaUK","description":"Securely build custom Docker image from private Azure Storage in Azure Container Registry (ACR), using Azure CLI.","archived":false,"fork":false,"pushed_at":"2024-12-30T21:19:49.000Z","size":536,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-30T21:36:17.833Z","etag":null,"topics":["azure","cli","container","docker","registry","security","storage"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LazaUK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-01T09:34:02.000Z","updated_at":"2024-12-30T21:29:33.000Z","dependencies_parsed_at":"2024-12-31T16:15:23.827Z","dependency_job_id":null,"html_url":"https://github.com/LazaUK/ACR-ProtectedStorage-CLI","commit_stats":null,"previous_names":["lazauk/acr-protectedstorage-cli"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LazaUK%2FACR-ProtectedStorage-CLI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LazaUK%2FACR-ProtectedStorage-CLI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LazaUK%2FACR-ProtectedStorage-CLI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LazaUK%2FACR-ProtectedStorage-CLI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LazaUK","download_url":"https://codeload.github.com/LazaUK/ACR-ProtectedStorage-CLI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240206994,"owners_count":19765041,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","cli","container","docker","registry","security","storage"],"created_at":"2025-01-03T11:14:45.377Z","updated_at":"2026-05-17T02:03:00.299Z","avatar_url":"https://github.com/LazaUK.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Azure Container Registry (ACR): Building custom image with tarball from non-public Azure Storage account\nBy default, blobs and containers on Azure Storage account are not accessible by anonymous accounts.\n\nThis repo explains how to use the **_Command Line Interface (CLI)_** to authenticate with _Azure Storage_ and _Azure Container Registry_ resources using **Entra ID** credentials. You'll also learn how to retrieve a tarball and use it to build a customised Docker image of an Nginx web service.\n\n\u003e [!NOTE]\n\u003e This step-by-step guide assumes that you are using Windows 11 on your development machine.\n\n## Table of contents:\n- [Pre-requisites](https://github.com/LazaUK/ACR-ProtectedStorage-CLI#pre-requisites)\n- [Step 1: Operations with Azure Storage account](https://github.com/LazaUK/ACR-ProtectedStorage-CLI#step-1-operations-with-azure-storage-account)\n- [Step 2: Operations with Azure Container Registry](https://github.com/LazaUK/ACR-ProtectedStorage-CLI#step-2-operations-with-azure-container-registry)\n- [Step 3: Testing customised Nginx Web service](https://github.com/LazaUK/ACR-ProtectedStorage-CLI#step-3-testing-customised-nginx-web-service)\n\n## Pre-requisites\n1. To build this demo, you'll need:\n    - An Azure subscription with an active Entra ID account,\n    - An Azure Storage account with a container holding the tarball,\n    - An Azure Container Registry (ACR),\n    - Docker installed on your development machine.\n2. Once you have all the above resources deployed, set relevant environment variables to support execution of CLI commands in the steps below.\n``` shell\nset MyRegistry=\u003cYOUR_ACR_RESOURCE\u003e\nset MyResourceGroup=\u003cRESOURCE_GROUP_OF_ACR\u003e\nset MyImage=\u003cTARGET_ACR_IMAGE_NAME\u003e\nset MyStorage=\u003cYOUR_STORAGE_RESOURCE\u003e\nset MyContainer=\u003cSTORAGE_CONTAINER_NAME\u003e\nset MyBlob=\u003cTARBALL_FILE_NAME\u003e\n```\n3. Use the ```az login``` command to authenticate with your Azure subscription using Entra ID credentials.\n\n## Step 1: Operations with Azure Storage account\n1. The following command lists all the blobs in the specified Azure Storage container. You can verify the presence of your tarball (_%MyBlob%_) here.\n``` PowerShell\naz storage blob list --account-name %MyStorage% --container-name %MyContainer% --output table --auth-mode login\n```\n\u003e [!NOTE]\n\u003e For demo purposes, you can re-use the _tarball_ provided with this repo.\n2. If the tarball exists, download the specified blob (_%MyBlob%_) from your storage account and place it in the _./src_ directory on your development machine.\n``` PowerShell\naz storage blob download --account-name %MyStorage% --container-name %MyContainer% --name %MyBlob% --file ./src/%MyBlob% --auth-mode login\n```\n\n## Step 2: Operations with Azure Container Registry\n1. Use the ```az acr build``` command to build a Docker image using the _Dockerfile_ and the downloaded tarball from the local ```src``` directory. Replace _%MyImage%_ with the desired image name for your development project.\n``` PowerShell\naz acr build --registry %MyRegistry% --image %MyImage%:latest --file Dockerfile ./src\n```\n\u003e [!NOTE]\n\u003e For demo purposes, you can re-use the _Dockerfile_ provided with this repo.\n\n## Step 3: Testing customised Nginx Web service\n1. Verify that your custom Docker image is listed in the ACR repository.\n``` PowerShell\naz acr repository list --name %MyRegistry% --output table\n```\n2. You can use the ```show-tags``` command to check the available tags for your image.\n``` PowerShell\naz acr repository show-tags --name %MyRegistry% --repository %MyImage% --output table\n```\n3. Now you are ready to run the image as a Docker container. This command maps port 8080 on your local machine to port 80 within the container.\n``` PowerShell\ndocker run -d --name %MyTask% -p 8080:80 %MyRegistry%.azurecr.io/%MyImage%:latest\n```\n4. You can verify the results by opening the Web page http://localhost:8080/ in your local browser.\n![Nginx_site](images/ACR_Tarball.gif)\n\n\u003e **Additional Considerations:**\n\u003e - If you're using a private ACR, ensure that you have the necessary permissions to access it.\n\u003e - You can customise the port mapping and container name to suit your needs.\n\u003e - For more complex scenarios, you might need to adjust the Dockerfile or the tarball contents to match your specific requirements.\n\nBy following these steps, you should be able to successfully build and deploy a custom Nginx web service using Azure Container Registry and a tarball from Azure Storage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazauk%2Facr-protectedstorage-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flazauk%2Facr-protectedstorage-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazauk%2Facr-protectedstorage-cli/lists"}