How to host a arm64 docker container on azure container apps - azure

I have an already existing docker image that is linux/arm64 because i have an m1 mac, but I want to host it on azure.
{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"WebhookInvalidParameterValue","message":"The following field(s) are either invalid or missing. Invalid value: "myregistry.azurecr.io/myproject:latest": image OS/Arc must be linux/amd64 but found linux/arm64: template.containers.myproject.image."}]}
Is it a way to host the existing image on azure or convert it to linux/amd64?

Currently, Azure Container Apps only support Linux-based x86-64 (linux/amd64) container images so you can't deploy an ARM-based container. Documentation
On a M1 Mac, you can build multiarch containers using Buildx. This way, you can build an x86-64 version of your container that you'll be able to deploy on Container Apps. Documentation

You can also build the container image using your Azure Container Registry, instead of building it locally using cross-compile. ACR can build it for amd64.
https://learn.microsoft.com/en-us/cli/azure/acr?view=azure-cli-latest#az-acr-build

Related

How can I create a Dockerfile FROM an Image in Azure Container Registry?

I've pushed an Image (which is a version of R + some libraries) on my private Azure Container Registry. How can build an Image starting from this Image?
In other words, I want to do "FROM registry/env:version" but I'm pretty sure that I need to use other settings to access my repository.
Thanks for help!
You should login your Docker daemon to your Azure Container Registry using the following command : docker login myregistry.azurecr.io --username $SP_APP_ID --password $SP_PASSWD
Then, using the fully qualified path for your image in the Dockerfile should work automatically, as long as the identity provided in the first step (login) has the rights to pull this image.
Sorry I'm trying to figure out your answer, I'm trying to pull a docker image from my Azure Container Registry and build it and push it back to a new repository. I'm starting my Dockerfile as
FROM xxxxxx.azurecr.io/php-7.4:latest AS compiled
how to configure the docker daemon in azure pipelines world?

Compare docker images in Azure cluster

I recently switched from AWS to Azure and i'm having issues with getting the docker to run in my daemonset.
On AWS I was pulling an image of a Pod and doing docker diff to compare that image with the original one.
But on Azure now i cannot access the docker and can't seem to find a way to get the original image and the current image with changes of the pod.
How can i do something like docker diff or at least pickup the two images in Azure ?
What version of Kubernetes are you running in AKS? Kubernetes has deprecated Docker as a container runtime after v1.20 so you can't run DOCKER DIFF on a node anymore.
Ref: https://kubernetes.io/blog/2020/12/02/dont-panic-kubernetes-and-docker/

Azure ACR Tasks API? Have an application running in docker container that needs to to build and push images to ACR

Application was using docker CLI to build and then push an image to azure container registry. Used to work fine on Kubernetes using a python module and docker.sock. But since cluster upgraded docker daemon is gone. Guessing the K8 backend no longer uses docker or has it installled. Also, since docker is going away in kubernetes (i think it said 1.24 I want to get away from counting on docker for the build.
So the application when working was python application running in a docker container. It would take the dockerfile and build it and push it to azure container registry. There are files that get pushed into the image via the dockerfile and they all exist in the same directory as the dockerfile.
Anyone know of different methods to achieve this?
I've been looking at Azure ACR Tasks but I'm not really sure how all the files get copied over to a task and have not been able to find any examples.
I can confirm that running an Azure ACR Task (Multi-Task or Quick Task) will copy the files over when the command is executed. We're using Azure ACR Quick Tasks to achieve something similar. If you're just trying to do the equivalent of docker build and docker push, Quick Tasks should work fine for you too.
For simplicity I'm gonna list the example for a Quick Task because that's what I've used mostly. Try the following steps from your local machine to see how it works. Same steps should also work from any other environment provided the machine is authenticated properly.
First make sure you are in the Dockerfile directory and then:
Authenticate to the Azure CLI using az login
Authenticate to your ACR using az acr login --name myacr.
Replace the values accordingly and run az acr build --registry myacr -g myacr_rg --image myacr.azurecr.io/myimage:v1.0 .
Your terminal should already show all of the steps that the Dockerfile is executing. Alternatively you can head over to your ACR and look under services>tasks>runs. You should see every line of the Docker build task appear there.
Note: If you're running this task in an automated fashion and also require access to internal/private resources during the image build, you should consider creating a Dedicated Agent Pool and deploying it in your VNET/SNET, instead of using the shared/public Agent Pools.
In my case, I'm using terraform to run the az acr build command and you can see the Dockerfile executes the COPY commands without any issues.

Docker registry on Linux host to store (not to run!) Windows-based images

As we all know:
"Basically, you cannot run windows containers in Linux.
Containers are not for virtualization, and they are using the resources of the host machine."
But what about Docker instance that works as a private Docker registry?
I`ve set up a private Docker registry on AltLinux and I want to redistribute some images for Windows.
If I do
docker pull mcr.microsoft.com/dotnet/core/runtime:3.1.4-nanoserver-1809
I get:
image operating system "windows" cannot be used on this platform
I understand: Windows image, Linux Docker host... But I don't want to run it here, I just want to keep in on my registry so that my Windows Server hosts could use those .NetCore and other Win-images.
I can succesfully pull .NetCore with Linux tag but then I can`t pull it from my local registry on my Windows Docker host.
What am I missing here? What universal platform then is being used to store both Linux and Windows-based images (like Docker hub)? Do I have to use two separate docker registries if I need to store Linux and Windows-based images there?

Deploy Azure Functions as IoT Edge modules

I have been trying to deploy an IoT Edge module to my IoT Edge device using the following link:
https://learn.microsoft.com/en-us/azure/iot-edge/tutorial-deploy-function
Everything appears to be working fine, however, when I right-click the deployment.template.json file and select Build IoT Edge solution I get the following output:
PS C:\Users\Carlton\Documents\OnAzureFunction\EdgeSolutionAF> docker build --rm -f "c:\Users\Carlton\Documents\OnAzureFunction\EdgeSolutionAF\modules\edgeonAzureF\Dockerfile.amd64" -t carlscontainer.azurecr.io/edgeonazuref:0.0.1-amd64 "c:\Users\Carlton\Documents\OnAzureFunction\EdgeSolutionAF\modules\edgeonAzureF" ; if ($?) { docker push carlscontainer.azurecr.io/edgeonazuref:0.0.1-amd64 }
Sending build context to Docker daemon 12.29kB
Step 1/3 : FROM mcr.microsoft.com/azureiotedge-functions-binding:1.0.0-linux-amd641.0.0-linux-amd64: Pulling from azureiotedge-functions-bindingimage operating system "linux" cannot be used on this platformPS C:\Users\Carlton\Documents\OnAzureFunction\EdgeSolutionAF>
As you can see Step 1/3 appears to fail.
error
What should happen is visual Studio Code first takes the information in the deployment template and generates a deployment.json file in a new config folder. Then it runs two commands in the integrated terminal: docker build and docker push. These two commands build your code, containerize the functions, and the push it to the container registry that you specified when you initialized the solution. However, as you can the docker push does not send it to the container registry.
Which container is running on the docker host,Linux container or Windows contianer?
You should switch the container to Linux Container(right click the docker icon in task bar -> Switch to Linux containers).

Resources