Compose Deploy Specification (original) (raw)

Deploy is an optional part of the Compose Specification. It provides a set of deployment specifications for managing the behavior of containers across different environments.

endpoint_mode

endpoint_mode specifies a service discovery method for external clients connecting to a service. The Compose Deploy Specification defines two canonical values:

labels

labels specifies metadata for the service. These labels are only set on the service and not on any containers for the service. This assumes the platform has some native concept of "service" that can match the Compose application model.

mode

mode defines the replication model used to run a service or job. Options include:

Note

For more detailed information about job options and behavior, see theDocker CLI documentation

placement

placement specifies constraints and preferences for the platform to select a physical node to run service containers.

constraints

constraints defines a required property the platform's node must fulfill to run the service container. For a further example, see theCLI reference docs.

preferences

preferences defines a strategy (currently spread is the only supported strategy) to spread tasks evenly over the values of the datacenter node label. For a further example, see theCLI reference docs

replicas

If the service is replicated (which is the default), replicas specifies the number of containers that should be running at any given time.

resources

resources configures physical resource constraints for container to run on platform. Those constraints can be configured as:

cpus

cpus configures a limit or reservation for how much of the available CPU resources, as number of cores, a container can use.

memory

memory configures a limit or reservation on the amount of memory a container can allocate, set as a string expressing abyte value.

pids

pids tunes a container’s PIDs limit, set as an integer.

devices

devices configures reservations of the devices a container can use. It contains a list of reservations, each set as an object with the following parameters: capabilities, driver, count, device_ids and options.

Devices are reserved using a list of capabilities, making capabilities the only required field. A device must satisfy all the requested capabilities for a successful reservation.

capabilities

capabilities are set as a list of strings, expressing both generic and driver specific capabilities. The following generic capabilities are recognized today:

To avoid name clashes, driver specific capabilities must be prefixed with the driver name. For example, reserving an NVIDIA CUDA-enabled accelerator might look like this:

driver

A different driver for the reserved device(s) can be requested using driver field. The value is specified as a string.

count

If count is set to all or not specified, Compose reserves all devices that satisfy the requested capabilities. Otherwise, Compose reserves at least the number of devices specified. The value is specified as an integer.

count and device_ids fields are exclusive. Compose returns an error if both are specified.

device_ids

If device_ids is set, Compose reserves devices with the specified IDs provided they satisfy the requested capabilities. The value is specified as a list of strings.

count and device_ids fields are exclusive. Compose returns an error if both are specified.

options

Driver specific options can be set with options as key-value pairs.

restart_policy

restart_policy configures if and how to restart containers when they exit. If restart_policy is not set, Compose considers the restart field set by the service configuration.

rollback_config

rollback_config configures how the service should be rollbacked in case of a failing update.

update_config

update_config configures how the service should be updated. Useful for configuring rolling updates.