'How to invoke Docker application when new file in Storage account

I'm not experienced in Azure but have successfully created a Container Registry, and pushed my Docker image to my registry, with my compiled software within the image.

I want the custom software (call it myapp.exe) to be invoked if there is a new file in an Azure Storage account. Maybe important: this is not a web-app but a CLI application that reads from STDIN and prints to STDOUT and would normally be ran on a personal machine.

What is the "right" way for this to work? I'm not even really sure to begin.

  • Should I have another program in my Docker image that continually polls some mounted Azure storage for changes? Can I even mount Azure storage in a docker image?
  • Or is there a hook you can setup in the Azure itself that if there's a file change do some process like somedockerimage-> myapp.exe.


Solution 1:[1]

There are many ways to achieve what you want without polling storage all the time. Here are a couple of solutions:

Create a Logic App that will be triggered by a new file in the storage account. The Logic App can deploy your image in Azure Container Instance passing the file name as a startup value. The Logic App can then loop until work has completed by inspecting the container output values. Then the Logic App deletes the ACI and proceeds with your next steps. https://docs.microsoft.com/en-us/azure/connectors/connectors-create-api-container-instances

A Function can achieve the same result: https://docs.microsoft.com/en-us/azure/container-instances/container-instances-tutorial-azure-function-trigger

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CSharpRocks