Container

A single application container. This specifies both the container to run, the command to run in the container and the arguments to supply to it. Note that additional arguments can be supplied by the system to the container at runtime.

JSON representation
{
  "name": string,
  "image": string,
  "command": [
    string
  ],
  "args": [
    string
  ],
  "env": [
    {
      object (EnvVar)
    }
  ],
  "resources": {
    object (ResourceRequirements)
  },
  "ports": [
    {
      object (ContainerPort)
    }
  ],
  "volumeMounts": [
    {
      object (VolumeMount)
    }
  ],
  "workingDir": string,
  "livenessProbe": {
    object (Probe)
  },
  "startupProbe": {
    object (Probe)
  },
  "dependsOn": [
    string
  ]
}
Fields
name

string

Name of the container specified as a DNS_LABEL (RFC 1123).

image

string

Required. Name of the container image in Dockerhub, Google Artifact Registry, or Google Container Registry. If the host is not provided, Dockerhub is assumed.

command[]

string

Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided.

args[]

string

Arguments to the entrypoint. The docker image's CMD is used if this is not provided.

env[]

object (EnvVar)

List of environment variables to set in the container.

resources

object (ResourceRequirements)

Compute Resource requirements by this container.

ports[]

object (ContainerPort)

List of ports to expose from the container. Only a single port can be specified. The specified ports must be listening on all interfaces (0.0.0.0) within the container to be accessible.

If omitted, a port number will be chosen and passed to the container through the PORT environment variable for the container to listen on.

volumeMounts[]

object (VolumeMount)

Volume to mount into the container's filesystem.

workingDir

string

Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image.

livenessProbe

object (Probe)

Periodic probe of container liveness. Container will be restarted if the probe fails.

startupProbe

object (Probe)

Startup probe of application within the container. All other probes are disabled if a startup probe is provided, until it succeeds. Container will not be added to service endpoints if the probe fails.

dependsOn[]

string

Names of the containers that must start before this container.

EnvVar

EnvVar represents an environment variable present in a Container.

JSON representation
{
  "name": string,

  // Union field values can be only one of the following:
  "value": string,
  "valueSource": {
    object (EnvVarSource)
  }
  // End of list of possible types for union field values.
}
Fields
name

string

Required. Name of the environment variable. Must not exceed 32768 characters.

Union field values.

values can be only one of the following:

value

string

Literal value of the environment variable. Defaults to "", and the maximum length is 32768 bytes. Variable references are not supported in Cloud Run.

valueSource

object (EnvVarSource)

Source for the environment variable's value.

EnvVarSource

EnvVarSource represents a source for the value of an EnvVar.

JSON representation
{
  "secretKeyRef": {
    object (SecretKeySelector)
  }
}
Fields
secretKeyRef

object (SecretKeySelector)

Selects a secret and a specific version from Cloud Secret Manager.

SecretKeySelector

SecretEnvVarSource represents a source for the value of an EnvVar.

JSON representation
{
  "secret": string,
  "version": string
}
Fields
secret

string

Required. The name of the secret in Cloud Secret Manager. Format: {secretName} if the secret is in the same project. projects/{project}/secrets/{secretName} if the secret is in a different project.

version

string

The Cloud Secret Manager secret version. Can be 'latest' for the latest version, an integer for a specific version, or a version alias.

ResourceRequirements

ResourceRequirements describes the compute resource requirements.

JSON representation
{
  "limits": {
    string: string,
    ...
  },
  "cpuIdle": boolean,
  "startupCpuBoost": boolean
}
Fields
limits

map (key: string, value: string)

Only memory and cpu keys in the map are supported.

Notes: * The only supported values for CPU are '1', '2', '4', and '8'. Setting 4 CPU requires at least 2Gi of memory. For more information, go to https://cloud.google.com/run/docs/configuring/cpu. * For supported 'memory' values and syntax, go to https://cloud.google.com/run/docs/configuring/memory-limits

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

cpuIdle

boolean

Determines whether CPU is only allocated during requests (true by default). However, if ResourceRequirements is set, the caller must explicitly set this field to true to preserve the default behavior.

startupCpuBoost

boolean

Determines whether CPU should be boosted on startup of a new container instance above the requested CPU threshold, this can help reduce cold-start latency.

ContainerPort

ContainerPort represents a network port in a single container.

JSON representation
{
  "name": string,
  "containerPort": integer
}
Fields
name

string

If specified, used to specify which protocol to use. Allowed values are "http1" and "h2c".

containerPort

integer

Port number the container listens on. This must be a valid TCP port number, 0 < containerPort < 65536.

VolumeMount

VolumeMount describes a mounting of a Volume within a container.

JSON representation
{
  "name": string,
  "mountPath": string
}
Fields
name

string

Required. This must match the Name of a Volume.

mountPath

string

Required. Path within the container at which the volume should be mounted. Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must otherwise be /cloudsql. All instances defined in the Volume will be available as /cloudsql/[instance]. For more information on Cloud SQL volumes, visit https://cloud.google.com/sql/docs/mysql/connect-run

Probe

Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.

JSON representation
{
  "initialDelaySeconds": integer,
  "timeoutSeconds": integer,
  "periodSeconds": integer,
  "failureThreshold": integer,

  // Union field probe_type can be only one of the following:
  "httpGet": {
    object (HTTPGetAction)
  },
  "tcpSocket": {
    object (TCPSocketAction)
  },
  "grpc": {
    object (GRPCAction)
  }
  // End of list of possible types for union field probe_type.
}
Fields
initialDelaySeconds

integer

Optional. Number of seconds after the container has started before the probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240.

timeoutSeconds

integer

Optional. Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 3600. Must be smaller than periodSeconds.

periodSeconds

integer

Optional. How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240. Must be greater or equal than timeoutSeconds.

failureThreshold

integer

Optional. Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.

Union field probe_type.

probe_type can be only one of the following:

httpGet

object (HTTPGetAction)

Optional. HTTPGet specifies the http request to perform. Exactly one of httpGet, tcpSocket, or grpc must be specified.

tcpSocket

object (TCPSocketAction)

Optional. TCPSocket specifies an action involving a TCP port. Exactly one of httpGet, tcpSocket, or grpc must be specified.

grpc

object (GRPCAction)

Optional. GRPC specifies an action involving a gRPC port. Exactly one of httpGet, tcpSocket, or grpc must be specified.

HTTPGetAction

HTTPGetAction describes an action based on HTTP Get requests.

JSON representation
{
  "path": string,
  "httpHeaders": [
    {
      object (HTTPHeader)
    }
  ],
  "port": integer
}
Fields
path

string

Optional. Path to access on the HTTP server. Defaults to '/'.

httpHeaders[]

object (HTTPHeader)

Optional. Custom headers to set in the request. HTTP allows repeated headers.

port

integer

Optional. Port number to access on the container. Must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.

HTTPHeader

HTTPHeader describes a custom header to be used in HTTP probes

JSON representation
{
  "name": string,
  "value": string
}
Fields
name

string

Required. The header field name

value

string

Optional. The header field value

TCPSocketAction

TCPSocketAction describes an action based on opening a socket

JSON representation
{
  "port": integer
}
Fields
port

integer

Optional. Port number to access on the container. Must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.

GRPCAction

GRPCAction describes an action involving a GRPC port.

JSON representation
{
  "port": integer,
  "service": string
}
Fields
port

integer

Optional. Port number of the gRPC service. Number must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.

service

string

Optional. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md ). If this is not specified, the default behavior is defined by gRPC.