Azure Container Apps manages the details of Kubernetes and container orchestration for you. Containers in Azure Container Apps can use any runtime, programming language, or development stack of your choice.
Azure Container Apps supports:
Any Linux-based x86-64 (linux/amd64) container image
Containers from any public or private container registry
Apps use the template configuration section to define the container image and other settings. Changes to the template configuration section trigger a new container app revision.
If a container crashes, it automatically restarts.
Jobs features include:
Job executions use the template configuration section to define the container image and other settings when each execution starts.
If a container exits with a non-zero exit code, the job execution is marked as failed. You can configure a job to retry failed executions.
Configuration
Most container apps have a single container. In advanced scenarios, an app may also have sidecar and init containers. In a container app definition, the main app and its sidecar containers are listed in the containers array in the properties.template section, and init containers are listed in the initContainers array. The following excerpt shows the available configuration options when setting up an app's containers.
When you use the Consumption plan, the total CPU and memory allocated to all the containers in a container app must add up to one of the following combinations.
vCPUs (cores)
Memory
0.25
0.5Gi
0.5
1.0Gi
0.75
1.5Gi
1.0
2.0Gi
1.25
2.5Gi
1.5
3.0Gi
1.75
3.5Gi
2.0
4.0Gi
2.25
4.5Gi
2.5
5.0Gi
2.75
5.5Gi
3.0
6.0Gi
3.25
6.5Gi
3.5
7.0Gi
3.75
7.5Gi
4.0
8.0Gi
Note
Apps using the Consumption plan in a Consumption only environment are limited to a maximum of 2 cores and 4Gi of memory.
Multiple containers
In advanced scenarios, you can run multiple containers in a single container app. Use this pattern only in specific instances where your containers are tightly coupled.
For most microservice scenarios, the best practice is to deploy each service as a separate container app.
Multiple containers in the same container app share hard disk and network resources and experience the same application lifecycle.
You can define multiple containers in a single container app to implement the sidecar pattern.
Examples of sidecar containers include:
An agent that reads logs from the primary app container on a shared volume and forwards them to a logging service.
A background process that refreshes a cache used by the primary app container in a shared volume.
These scenarios are examples, and don't represent the only ways you can implement a sidecar.
To run multiple containers in a container app, add more than one container in the containers array of the container app template.
Init containers
You can define one or more init containers in a container app. Init containers run before the primary app container and are used to perform initialization tasks such as downloading data or preparing the environment.
Init containers are defined in the initContainers array of the container app template. The containers run in the order they're defined in the array and must complete successfully before the primary app container starts.
Note
Init containers in apps using the Dedicated plan or running in a Consumption only environment can't access managed identity at run time.
Container registries
You can deploy images hosted on private registries by providing credentials in the Container Apps configuration.
To use a container registry, you define the registry in the registries array in the properties.configuration section of the container app resource template. The passwordSecretRef field identifies the name of the secret in the secrets array name where you defined the password.
Docker Hub limits the number of Docker image downloads. When the limit is reached, containers in your app will fail to start. Use a registry with sufficient limits, such as Azure Container Registry to avoid this problem.
Managed identity with Azure Container Registry
You can use an Azure managed identity to authenticate with Azure Container Registry instead of using a username and password. For more information, see Managed identities in Azure Container Apps.
To use managed identity with a registry, the identity must be enabled in the app and it must be assigned acrPull role in the registry. To configure the registry, use the managed identity resource ID for a user-assigned identity, or system for the system-assigned identity in the identity property of the registry. Don't configure a username and password when using managed identity.
Operating system: Linux-based (linux/amd64) container images are required.
Maximum image size:
Consumption workload profile supports container images totaling up to 8GB for each app or job replica.
Dedicated workload profiles support larger container images. Because a Dedicated workload profile can run multiple apps or jobs, multiple container images share the available disk space. The actual supported image size varies based on resources consumed by other apps and jobs.
Learn how to build, deploy, scale, and manage containerized cloud-native apps using Azure Container Apps, Azure Container Registry, and Azure Pipelines. (AZ-2003)