citronas
citronas

Reputation: 19365

How to run a briefly running Docker container on Azure on a daily basis?

In the past, I've been using WebJobs to schedule small recurrent tasks that perform a specific background task, e.g., generating a daily summary of user activities. For each task, I've written a console application in C# that was published as an Azure Webjob.

Now I'd like to daily execute some Python code that is already working in a Docker container. I think I figured out how to get a container running in Azure. Right now, I want to minimize the operation cost since the container will only run for a duration of 5 minutes. Therefore, I'd like to somehow schedule that my container starts once per day (at 1am) and shuts down after completion. How can I achieve this setup in Azure?

Upvotes: 0

Views: 916

Answers (2)

Beshoy Hanna
Beshoy Hanna

Reputation: 621

Azure Functions has what you need to schedule daily tasks. In your case, you would select the Python runtime and schedule the job though Azure Portal (Select the Timer option)

Upvotes: 0

4c74356b41
4c74356b41

Reputation: 72171

I'd probably write a scheduled build job on vsts\whatever to run at 1am daily to launch a container on Azure Container Instances. Container should shutdown on its own when the program exists (so your program has to do that without help from outside).

Upvotes: 4

Related Questions