Linux container support in Azure Functions
When you plan and develop your individual functions to run in Azure Functions, you're typically focused on the code itself. Azure Functions makes it easy to deploy just your code project to a function app in Azure. When you deploy your code project to a function app that runs on Linux, the project runs in a container that is created for you automatically. This container is managed by Functions.
Functions also supports containerized function app deployments. In a containerized deployment, you create your own function app instance in a local Docker container from a supported based image. You can then deploy this containerized function app to a hosting environment in Azure. Creating your own function app container lets you customize or otherwise control the immediate runtime environment of your function code.
Important
When creating your own containers, you are required to keep the base image of your container updated to the latest supported base image. Supported base images for Azure Functions are language-specific and are found in the Azure Functions base image repos.
The Functions team is committed to publishing monthly updates for these base images. Regular updates include the latest minor version updates and security fixes for both the Functions runtime and languages. You should regularly update your container from the latest base image and redeploy the updated version of your container.
Container hosting options
There are several options for hosting your containerized function apps in Azure:
Hosting option | Benefits |
---|---|
Azure Container Apps | Azure Functions provides integrated support for developing, deploying, and managing containerized function apps on Azure Container Apps. This enables you to manage your apps using the same Functions tools and pages in the Azure portal. Use Azure Container Apps to host your function app containers when you need to run your event-driven functions in Azure in the same environment as other microservices, APIs, websites, workflows, or any container hosted programs. Container Apps hosting lets you run your functions in a managed Kubernetes-based environment with built-in support for open-source monitoring, mTLS, Dapr, and KEDA. Supports scale-to-zero and provides a servless pay-for-what-you-use hosting model. You can also request dedicated hardware, even GPUs, by using workload profiles. Recommended hosting option for running containerized function apps on Azure. |
Azure Arc-enabled Kubernetes clusters (preview) | You can host your function apps on Azure Arc-enabled Kubernetes clusters as either a code-only deployment or in a custom Linux container. Azure Arc lets you attach Kubernetes clusters so that you can manage and configure them in Azure. Hosting Azure Functions containers on Azure Arc-enabled Kubernetes clusters is currently in preview. |
Azure Functions | You can host your containerized function apps in Azure Functions by running the container in either an Elastic Premium plan or a Dedicated plan. Premium plan hosting provides you with the benefits of dynamic scaling. You might want to use Dedicated plan hosting to take advantage of existing unused App Service plan resources. |
Kubernetes | Because the Azure Functions runtime provides flexibility in hosting where and how you want, you can host and manage your function app containers directly in Kubernetes clusters. KEDA (Kubernetes-based Event Driven Autoscaling) pairs seamlessly with the Azure Functions runtime and tooling to provide event driven scale in Kubernetes. Just keep in mind that running your containerized function apps on Kubernetes, either by using KEDA or by direct deployment, is an open-source effort that you can use free of cost, with best-effort support provided by contributors and from the community. You're responsible for maintaining your own function app containers in a cluster, even when deploying to Azure Kubernetes Service (AKS). |
Feature support comparison
The degree to which various features and behaviors of Azure Functions are supported when running your function app in a container depends on the container hosting option you choose.
Feature/behavior | Container Apps (integrated) | Container Apps (direct) | Premium plan | Dedicated plan | Kubernetes |
---|---|---|---|---|---|
Product support | Yes | No | Yes | Yes | No |
Functions portal integration | Yes | No | Yes | Yes | No |
Event-driven scaling | Yes5 | Yes (scale rules) | Yes | No | No |
Maximum scale (instances) | 10001 | 10001 | 1002 | 10-303 | Varies by cluster |
Scale-to-zero instances | Yes | Yes | No | No | KEDA |
Execution time limit | Unbounded6 | Unbounded6 | Unbounded7 | Unbounded8 | None |
Core Tools deployment | func azurecontainerapps |
No | No | No | func kubernetes |
Revisions | No | Yes | No | No | No |
Deployment slots | No | No | Yes | Yes | No |
Streaming logs | Yes | Yes | Yes | Yes | No |
Console access | Not currently available4 | Yes | Yes (using Kudu) | Yes (using Kudu) | Yes (in pods using kubctl ) |
Cold start mitigation | Minimum replicas | Scale rules | Always-ready/pre-warmed instances | n/a | n/a |
App Service authentication | Not currently available4 | Yes | Yes | Yes | No |
Custom domain names | Not currently available4 | Yes | Yes | Yes | No |
Private key certificates | Not currently available4 | Yes | Yes | Yes | No |
Virtual networks | Yes | Yes | Yes | Yes | Yes |
Availability zones | Yes | Yes | Yes | Yes | Yes |
Diagnostics | Not currently available4 | Yes | Yes | Yes | No |
Dedicated hardware | Yes (workload profiles) | Yes (workload profiles) | No | Yes | Yes |
Dedicated GPUs | Yes (workload profiles) | Yes (workload profiles) | No | No | Yes |
Configurable memory/CPU count | Yes | Yes | No | No | Yes |
"Free grant" option | Yes | Yes | No | No | No |
Pricing details | Container Apps billing | Container Apps billing | Premium plan billing | Dedicated plan billing | AKS pricing |
Service name requirements | 2-32 characters: limited to lowercase letters, numbers, and hyphens. Must start with a letter and end with an alphanumeric character. | 2-32 characters: limited to lowercase letters, numbers, and hyphens. Must start with a letter and end with an alphanumeric character. | Less than 64 characters: limited to alphanumeric characters and hyphens. Can't start with or end in a hyphen. | Less than 64 characters: limited to alphanumeric characters and hyphens. Can't start with or end in a hyphen. | Less than 253 characters: limited to alphanumeric characters and hyphens. Must start and end with an alphanumeric character. |
- On Container Apps, the default is 10 instances, but you can set the maximum number of replicas, which has an overall maximum of 1000. This setting is honored as long as there's enough cores quota available. When you create your function app from the Azure portal, you're limited to 300 instances.
- In some regions, Linux apps on a Premium plan can scale to 100 instances. For more information, see the Premium plan article.
- For specific limits for the various App Service plan options, see the App Service plan limits.
- Feature parity is a goal of integrated hosting on Azure Container Apps.
- Requires KEDA; supported by most triggers. To learn which triggers support event-driven scaling, see Considerations for Container Apps hosting.
- When the minimum number of replicas is set to zero, the default timeout depends on the specific triggers used in the app.
- There's no maximum execution timeout duration enforced. However, the grace period given to a function execution is 60 minutes during scale in, and a grace period of 10 minutes is given during platform updates.
- Requires the App Service plan be set to Always On. A grace period of 10 minutes is given during platform updates.
Getting started
Use these links to get started working with Azure Functions in Linux containers:
I want to... | See article: |
---|---|
Create my first containerized functions | Create a function app in a local Linux container |
Create and deploy functions to Azure Container Apps | Create your first containerized functions on Azure Container Apps |
Create and deploy containerized functions to Azure Functions | Create your first containerized Azure Functions |
Create and deploy functions to Azure Arc-enabled Kubernetes | Create your first containerized Azure Functions on Azure Arc (preview) |