Skip to content

Latest commit

 

History

History
135 lines (117 loc) · 4.73 KB

File metadata and controls

135 lines (117 loc) · 4.73 KB

Create an Azure Container Registry, and push your container to a registry

Goal: The goal of this section is to publish the container image to a private Azure Container Registry.

Azure Subscription

If you do not have one, you can get a trial subscription here: https://azure.microsoft.com/en-us/free/

Process

Step Procedure
Create a container registry

Create a private container registry using the Azure Container Registry service.

Note: This requires an Azure account

Build, tag and push the container image Create a production ready container image and push it to the registry.
Pull the container image and run it locally Pull the production ready image from the container registry and run it.

Create a container registry

In this section we will create a private container registry in Azure using Azure Container Registry.

Step Action Result
1 Browse to https://shell.azure.com/ and sign-in to your Azure subscription. If you do not have one, you can get a trial subscription here: https://azure.microsoft.com/en-us/free/
2

Create a new resource group:

az group create --name [insert rg name] --location eastus

Note: Substitute the [insert rg name] with the name for your Resource Group

az will output information about the resource group.
3

Create a container registry in that resource group:

az acr create --resource-group [insert rg name] --name [insert acr name] --sku Basic --admin-enabled

Note: Substitute the [insert acr name] with the name for your registry name

az will output the information about the newly created acr.
4

Retrieve the credentials to sign-in to the container registry, and note these to be used later:

az acr credential show --name [insert acr name]

Note: Substitute the [insert acr name] with the name for your registry name

az will output the passwords and login names for the registry, which we will use later in the lab.

Completion

In this section of the lab, we’ve created a private container registry as a repository to store your container images.

Build, tag and push the container

In this section we will prepare our container image to be uploaded, by tagging it and upload the image to our registry.

Step Action Result
1

Open PowerShell and run the following command to tag the image:

docker tag eshopweb:1.0 [insert acr name].azurecr.io/eshopweb:1.0

Note:

The registry part of the container image tag should match the name of your container registry.

This command creates a container image tag with the container registry name and version of the container image.
2

Run the following command to login to your container registry:

docker login [insert acr name].azurecr.io

Note:

To retrieve the login server, username and password, see above section

3

Push the container image to your registry:

docker push [insert acr name].azurecr.io/eshopweb:1.0

This will start uploading the container image layers to you Azure Container Registry.

Completion

In this section of the lab, we’ve tagged our container image and uploaded it to our private container registry, ready to be deployed to any container host.

Clean up

Finally, let’s clean-up, by running the following commands in PowerShell in the directory C:\Users\Administrator\Desktop\Lab:

  1. git clean -df
  2. git reset --hard