Deploying compute workloads by using images and containers Part 2 – Deploy a Docker container image to Container Registry

Now let’s deploy a docker container to an Azure Container Registry.

Launch the cloudshell from the Azure Portal and create a folder and a dotnet console application.

cd clouddrive
mkdir ipcheck
cd ipcheck/

Create a new console project

dotnet new console

Create a new file called Dockerfile and launch code inside the cloudshell.

Copy the sourcecode from the learn excercise and run the application to verify that the ipaddress is found.

And finally copy the sourcecode to the Dockerfile, save and close.

Now in the next part we will create an Azure container registry and publish our ipcheck console application!

Deploying compute workloads in Azure by using images and containers Part 1 – Create a VM using Azure CLI

In Lab 05 here we will deploy Docker containers into Azure Container Registry.

Connect to Azure and create a resource group and the VM.

az group create --location westeurope -n 05lab-rg
az vm create --name quickvm -g 05lab-rg --image Debian --admin-username xyz --admin-password xyz

Now check the ipadress and note it.

az vm list-ip-addresses

Now let’s connect using SSH.

ssh student@ip-adress

There you go! You just connected to your very own debian vm in Azure!

In the next post we’ll create a docker container.

Install Docker on a Azure Linux VM, upload a docker image to Azure Container Registry and Deploy a Azure Container Instance Part 6 – Create an Azure container instance from a private registry

Now in our final post we’ll use our uploaded hello-azure-world image to deploy an Azure container instance.

First inside our registry we must grant admin role to the registry.

Denna bild har ett alt-attribut som är tomt. Dess filnamn är image-64.png

Next, Search for Azure container instance in the martket place and select create and use your uploaded image.

Move into the container and inside logs you’ll find that the container have launched and is displaying the hello-word container as it should.

Done and done! Good job!

Install Docker on a Azure Linux VM, upload a docker image to Azure Container Registry and Deploy a Azure Container Instance Part 5 – Push a docker image to Azure Registry

Let’s push our hello world to Azure Registry. You can check it out here.

First we must install the Azure CLI on our linux vm. Run the installer script.

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Next sign in to Azure on your Linux vm.

az login

Next sign in to the azure container registry, Don’t include the ‘azurecr.io’ domain suffix.

az acr login --name 

Next tag the hello world image with your container registry name. The login server name is in the format <registry-name>.azurecr.io (all lowercase), for example, mycontainerregistry.azurecr.io.

docker tag hello-world /hello-azure-world:v1

Perfect! Now with the tag let’s push to our registry!

docker push /hello-azure-world:v1

Let’s quickly jump over to the Azure portal and check our uploaded image.

You can also check from az cli with

az acr repository list -n registryname

And finally you can now download your own hello world container from your very own Azure Container Registry!

docker run /hello-azure-world:v1

There you go! You just uploaded your very own Docker image to an Azure Container Registry and deployed it.

Now in the last post we will create an Docker instance from our hello world

Install Docker on a Azure Linux VM, upload a docker image to Azure Container Registry and Deploy a Azure Container Instance Part 4 – Create Azure Container Registry

Before we can upload our docker image we need to create an Azure Registry. So let’s do that!

Jump in to the Azure portal and search for Docker Registry in the portal and select create.

Now in the next post we’ll push our image into our very own public Azure container registry!

Install Docker on a Azure Linux VM, upload a docker image to Azure Container Registry and Deploy a Azure Container Instance Part 3 – Install Docker

Head over to Dockers site for the installation guide of Docker here.

Now let’s install docker.

sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

Add the GPG key to trust software by Docker.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Since we are running ARM you’ll select the ARM architecture

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

Now it’s time to run and install Docker on Raspberry Pi.

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Finally configure docker to be able to run without sudo.

sudo groupadd docker
sudo usermod -aG docker $USER

Now log out and in again and test your Docker installation!

$ docker run hello-world

In the next post we will create an Azure Container Registry to host our new Docker image.

Install Docker on a Azure Linux VM, upload a docker image to Azure Container Registry and Deploy a Azure Container Instance Part 2 – Install a linux VM in Azure

First let’s create the VM. You can read more about it in Azure docs here.

First create a resource group to hold your VM and other resources.

az group create --name TutorialResources --location eastus

Next let’s create the Ubuntu VM.

az vm create --resource-group TutorialResources \
  --admin-username azureuser
  --name TutorialVM1 \
  --image UbuntuLTS \
  --generate-ssh-keys \
  --output json \
  --verbose

Once done try and connect using ssh and the public IP adress that displayed as part of the verbose output.

ssh azureuser@ip-adress

There we go! Now in the next post we’ll install docker.

Install Docker on a Azure Linux VM, upload a docker image to Azure Container Registry and Deploy a Azure Container Instance Part 1 – Install Azure CLI and the VSCode extension

Let’s go!

Before installing the CLI tools in VSCode make sure that you have installed the Azure CLI on your client here.

Now download and install the Azure CLI Tools so we get the Intellisense in VSCode. Search and install and restart VSCode.

Next create a file with the .azcli type so that the extension will recognize the file.

Now in the next part we will deploy the Linux VM in Azure using AZ Cli.