How can I deploy Airflow on docker compose? - azure

I can find the docker-compose.yaml file from Apache official website here
I am able to run airflow, the docker images are pulled the official images, everything works perfectly on my local machine.
However, my question is, how can I deploy airflow with docker-compose on a Cloud managed service? e.g. Azure App Service
I am using Azure, but it seems to me that Azure container registry won't work. I cannot push the docker image as I am not building any image.

Related

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.

Deploy CKan Docker image using Azure Container Registry

I am trying to deploy the Ckan docker image that is being provided at https://github.com/keitaroinc/docker-ckan. I cloned the repo and tried to change the yaml config of docker compose file to change the image names to values as suggested in https://learn.microsoft.com/en-us/azure/container-instances/tutorial-docker-compose. But it seems not to work. Anyone has any idea how can I deploy this using Azure Container Registry and Azure Container Instances?

.Net Core Docker is deleting images(pictures) while building it on DigitalOcean

I have deployed .net core 3.1 project on DigitalOcean using docker. In my project inside wwwroot directory, there is an images directory where I am uploading my pictures. After uploading, I can see pictures in the browser.
But the problem is if I am building a docker project again and running it then it doesn't show the pictures which have been previously uploaded.
My docker build command is: docker build -t "jugaadhai-service" --file Dockerfile .
and docker run command is docker run -it -d -p 0.0.0.0:2900:80 jugaadhai-service
EDIT 1: After some searching I came to know that when project is running through docker then files are getting uploaded in docker's containers directory not in projects directory. That's why images are not coming on new build.
So when a docker container is created, it's an isolated virtual environment running on a host machine. If the host machine is your local computer or some host in the cloud does not really matter, it works the same way. The container is created from the build definition in the Dockerfile.
This means you can replicate this on your local environment, try build the image, upload a few images and then delete the image or create a new image with the same tag. The images are also gone then.
If you upload images or file to a container on let's say DigitalOcean, and you redeploy a new container with a different tag, the images still lives inside the old container. Same thing if you run on let's say kubernetes, if a pod/container restart has happen, again everything is lost forever and it's as if a new container was built.
This is where volumes comes in to play. So when you have persistent data you want to store, you should store them outside of the container itself. If you want to store the images on the host machine or some other network drive, you have to specify that and map it with the container.
You can find out more about it here:
https://docs.docker.com/storage/volumes/
https://docs.docker.com/storage/
https://www.youtube.com/watch?v=Nxi0CR2lCUc
https://medium.com/bb-tutorials-and-thoughts/understanding-docker-volumes-with-an-example-d898cb5e40d7

Migration of docker image from AWS to Bluemix or Azure

I have a newbie regarding docker. I would like to know if it is possible to export a docker image created for AWS to Bluemix or Azure. My docker image contains a websocket server under NodeJS and a MongoDB database.
Thank you for your help
Access your aws cloud and use:
docker save -o image.tar image:1.0 #exporte docker image
After concluded that, access your new cloud and use:
docker load -i image.tar #load your image to the new cloud
Having the dockerfile you used to create your AWS container, you can simply use it to build the container on Bluemix using cf ic client or the docker native one
Following the reference doc for Bluemix docker cli
https://www.ng.bluemix.net/docs/containers/container_cli_reference_ov.html
https://www.ng.bluemix.net/docs/containers/container_cli_ov.html

Resources