Radius.Compute/containers@2025-08-01-preview

Description

The Radius.Compute/containers Resource Type is the primary resource type for running one or more containers. It is always part of a Radius Application. To deploy a Container add a resource to the application definition Bicep file.

extension radius
param environment string 

resource myApplication 'Radius.Core/applications@2025-08-01-preview' = { ... }

resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {
  name: 'myContainer'
  properties: {
    environment: environment
    application: myApplication.id
    containers: {
      demo: {
        image: 'ghcr.io/radius-project/samples/demo:latest'
      }
    }
  }
}

By default, Containers deploys to Kubernetes. In this case, a Kubernetes Deployment named myContainer is deployed which includes a Pod named myContainer. Your Radius environment may deploy to other container platforms such as Azure Container Instances.

To accept network connections, expose a port on the container.

resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {
  name: 'myContainer'
  properties: {
    environment: environment
    application: myApplication.id
    containers: {
      demo: {
        image: 'ghcr.io/radius-project/samples/demo:latest'
        ports: {
          web: {
            containerPort: 3000
          }
        }
      }
    }
  }
}

When a port is included, a Kubernetes Service named demo with the type ClusterIP is created.

To create an ephemeral emptyDir shared between two containers add a Containers.properties.volumes.

resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {
  name: 'myContainer'
  properties: {
    environment: environment
    application: myApplication.id
    containers: {
      frontend: {
        image: 'frontend:latest'
        volumeMounts: [
          {
            volumeName: 'shared'
            mountPath: '/var/shared' 
          }
        ]
      }
      backend: {
        image: 'backend:latest'
        volumeMounts: [
          {
            volumeName: 'shared'
            mountPath: '/var/shared' 
          }
        ]
      }
    }
    volumes: {
      shared: {
        emptyDir: {}
      }
    }
  }
}

To mount a persistent volume or secret see the PersistentVolumes and Secrets Resource Types.

Top-Level Properties

PropertyTypeDescription
applicationstring(Required) The Radius Application ID. myApplication.id for example.
autoScalingobject
codeReferencestringOptional URI to the source code of this resource type. ex: https://github.com/radius-project/radius/blob/4fab87e8127adf1db6f43b7029d5235fbe82c5c9/cmd/controller/main.go#L27
connectionsobject(Optional) Map of resources this container is dependent upon. `db: { source: db.id } for example.
containersobject
environmentstring(Required) The Radius Environment ID. Typically set by the rad CLI. Typically value should be environment.
extensionsobject(Optional) Properties for additional functionality. daprSidecar is the only available option.
platformOptionsobject(Optional) If enabled by the platform engineer, properties to be passed to the Recipe for the specified platform.
replicasinteger(Optional) The minimum number of replicas for the set of containers.
restartPolicystring(Optional) Defines how a containers behave when they terminate. Always will restart containers regardless of their exit status. OnFailure will restart containers if they return a non-zero exit code.
Allowed values: Always, Never, OnFailure.
volumesobject(Optional) List of volumes that can be mounted by a container.

Object Properties

autoScaling

PropertyTypeDescription
maxReplicasinteger(Optional) The maximum number of replicas for the autoscaler.
metricsobject[](Required) The metric to measure and target used to autoscale.

connections

PropertyTypeDescription
disableDefaultEnvVarsboolean(Optional) Disables the automatic injection of environment variables from connected resource properties.
sourcestring(Required) The resource ID of the resource this container is dependent upon.

containers

PropertyTypeDescription
argsstring array(Optional) Arguments for the command. Overrides the container image CMD. ["echo Hello", "&&", "echo World"] for example.
commandstring array(Optional) Command the container runs. Overrides the container image ENTRYPOINT. ["/bin/sh", "-c"] for example.
envobject(Optional) Environment variables injected into the container.
imagestring(Required) The container image. ghcr.io/radius-project/samples/demo:latest for example.
initContainerboolean(Optional) Set to true if container should run and succeed prior to other containers starting.
livenessProbeobject(Optional) A liveness probe defines a check (a probe) to determine if a container is healthy.
portsobject(Optional) Network ports exposed by the container. A network endpoint is created for each port. For L7 ingress create a Routes resource.
readinessProbeobject(Optional) A readiness probe defines a check (a probe) to determine when a container is ready to begin accepting traffic.
resourcesobject(Optional) Compute resource requirements for the container.
volumeMountsobject[](Optional) Volumes to mount in the container.
workingDirstring(Optional) The working directory inside the container. /usr/share for example.

extensions

PropertyTypeDescription
daprSidecarobject(Optional) When set the daprSidecar container is configured.

volumes

PropertyTypeDescription
emptyDirobject(Optional) An empty directory.
persistentVolumeobject(Optional) Mount an existing Radius PersistentVolume resource.
secretNamestring(Optional) The Radius Secret resource name.

autoScaling.metrics

PropertyTypeDescription
customMetricstring(Optional) The custom metric exposed by the application. Implementation specific. See platform engineer for further guidance.
kindstring(Required) The metric to measure.
Allowed values: cpu, custom, memory.
targetobject(Required) When the metric exceeds the target value specified, autoscaling is triggered. Only one target value can be specified dependent upon the type.

containers.env

PropertyTypeDescription
valuestring(Optional) String value of the environment variable.
valueFromobject

containers.livenessProbe

PropertyTypeDescription
execobject(Optional) An exec probe runs a command within a container. If the command succeeds and returns 0 the probe is healthy.
failureThresholdinteger(Optional) Minimum consecutive failures for the probe to be considered failed after having succeeded. Assumed to be 3 if not specified.
httpGetobject(Optional) A httpGet probe performs a HTTP GET against the container on the specified port. If the HTTP server returns a code greater than or equal to 200 and less than 400 the probe is healthy.
initialDelaySecondsinteger(Optional) Number of seconds after the container has started before probes are initiated.
periodSecondsinteger(Optional) How often to perform the probe. Assumed to be 10 seconds if not specified.
successThresholdinteger(Optional) Minimum consecutive successes for the probe to be considered successful after having failed. Assumed to be 1 if not specified.
tcpSocketobject(Optional) A TCP socket probe establishes a TCP connection to the container on the specified port. If a connection is established the probe is healthy.
terminationGracePeriodSecondsinteger(Optional) Number of seconds the container needs to terminate gracefully upon probe failure. The grace period amount of time between when a container is sent a termination signal and the time when the processes are forcibly halted with a kill signal.
timeoutSecondsinteger(Optional) Number of seconds after which the probe times out. Assumed to be 1 second if not specified.

containers.ports

PropertyTypeDescription
containerPortinteger(Required) The network port the container is listening on. 443 for example.
protocolstring(Optional) The protocol. If not specified, TCP is assumed.
Allowed values: TCP, UDP.

containers.readinessProbe

PropertyTypeDescription
execobject(Optional) An exec probe runs a command within a container. If the command succeeds and returns 0 the probe is healthy.
failureThresholdinteger(Optional) Minimum consecutive failures for the probe to be considered failed after having succeeded. Assumed to be 3 if not specified.
httpGetobject(Optional) A httpGet probe performs a HTTP GET against the container on the specified port. If the HTTP server returns a code greater than or equal to 200 and less than 400 the probe is healthy.
initialDelaySecondsinteger(Optional) Number of seconds after the container has started before probes are initiated.
periodSecondsinteger(Optional) How often to perform the probe. Assumed to be 10 seconds if not specified.
successThresholdinteger(Optional) Minimum consecutive successes for the probe to be considered successful after having failed. Assumed to be 1 if not specified.
tcpSocketobject(Optional) A TCP socket probe establishes a TCP connection to the container on the specified port. If a connection is established the probe is healthy.
terminationGracePeriodSecondsinteger(Optional) Number of seconds the container needs to terminate gracefully upon probe failure. The grace period amount of time between when a container is sent a termination signal and the time when the processes are forcibly halted with a kill signal.
timeoutSecondsinteger(Optional) Number of seconds after which the probe times out. Assumed to be 1 second if not specified.

containers.resources

PropertyTypeDescription
limitsobject(Optional) Limits define the maximum amount of CPU or memory the container can consume.
requestsobject(Optional) Requests define the minimum amount of CPU or memory that is required by the container.

containers.volumeMounts

PropertyTypeDescription
mountPathstring(Required) The path to mount the volume in the container file system.
volumeNamestring(Required) The name of the volume defined in Containers.properties.volumes.

extensions.daprSidecar

PropertyTypeDescription
appIdstring(Optional) The unique ID of the Dapr application. Used for service discovery, state encapsulation and the pub/sub consumer ID.
appPortinteger(Optional) The port your application is listening on.
configstring(Optional) The Dapr Configuration resource name.

volumes.emptyDir

PropertyTypeDescription
mediumstring(Optional) Set to memory for a tmpfs (RAM backed filesystem). Note that while tmpfs is very fast storage counts against the memory limit of the container.
Allowed values: disk, memory.

volumes.persistentVolume

PropertyTypeDescription
accessModestring(Optional) Set to ReadWriteOnce if no other Containers can mount in read/write mode. Set to ReadOnlyMany to enable other Containers to mount in read-only mode. Set to ReadWriteMany to allow multiple containers to mount in read/write mode. Assumed to be ReadWriteOnce if not specified.
Allowed values: ReadOnlyMany, ReadWriteMany, ReadWriteOnce.
resourceIdstring(Required) The Radius PersistentVolume resource ID.

autoScaling.metrics.target

PropertyTypeDescription
averageUtilizationinteger(Optional) The average CPU or memory utilization across all containers expressed as a percentage. Kind must be CPU or memory.
averageValueinteger(Optional) The average value of the metric as a quantity.
valueinteger(Optional) The absolute value of the metric as a quantity.

containers.env.valueFrom

PropertyTypeDescription
secretKeyRefobject(Optional) Set the environment variable value based on a Radius Secrets resource.

containers.livenessProbe.exec

PropertyTypeDescription
commandstring array(Required) The command to run inside the container. ["cat", "/tmp/healthy"] for example.

containers.livenessProbe.httpGet

PropertyTypeDescription
httpHeadersobject[](Optional) Custom HTTP headers to be included in the GET request.
pathstring(Required) The path to access on the HTTP server.
portinteger(Required) The TCP port connect to on the container.
schemestring(Optional) HTTP or HTTPS. Assumes HTTP is not specified.
Allowed values: http, https.

containers.livenessProbe.tcpSocket

PropertyTypeDescription
portinteger(Required) The TCP port to connect to.

containers.readinessProbe.exec

PropertyTypeDescription
commandstring array

containers.readinessProbe.httpGet

PropertyTypeDescription
httpHeadersobject[](Optional) Custom HTTP headers to be included in the GET request.
pathstring(Required) The path to access on the HTTP server.
portinteger(Required) The TCP port connect to on the container.
schemestring(Optional) HTTP or HTTPS. Assumes HTTP is not specified.
Allowed values: http, https.

containers.readinessProbe.tcpSocket

PropertyTypeDescription
portinteger(Required) The TCP port to connect to.

containers.resources.limits

PropertyTypeDescription
cpustring(Optional) The maximum number of vCPUs which can be used by the container.
memoryInMibinteger(Optional) The maximum amount of memory which can be used by the container in MiB.

containers.resources.requests

PropertyTypeDescription
cpustring(Optional) The minimum number of vCPUs required by the container. 0.1 results in one tenth of a vCPU being reserved.
memoryInMibinteger(Optional) The minimum amount of memory required by the container in MiB. 1024 results in 1 GiB of memory being reserved.

containers.env.valueFrom.secretKeyRef

PropertyTypeDescription
keystring(Optional) The key of the Radius Secrets resource. The value of the key will be used as the environment variable value.
secretNamestring(Optional) The name of the Radius Secrets resource.

containers.livenessProbe.httpGet.httpHeaders

PropertyTypeDescription
valuestring(Required) The header field value.

containers.readinessProbe.httpGet.httpHeaders

PropertyTypeDescription
valuestring(Required) The header field value.