docker-compose.yml
The Compose specification establishes a standard for the definition of multi-container platform-agnostic applications
| Type | object |
|---|---|
| File match |
**/docker-compose.yml
**/docker-compose.yaml
**/docker-compose.*.yml
**/docker-compose.*.yaml
**/compose.yml
**/compose.yaml
**/compose.*.yml
**/compose.*.yaml
|
| Schema URL | https://catalog.lintel.tools/schemas/schemastore/docker-compose-yml/latest.json |
| Source | https://raw.githubusercontent.com/compose-spec/compose-go/master/schema/compose-spec.json |
Validate with Lintel
npx @lintel/lintel check
The Compose file is a YAML file defining a multi-containers based application.
Properties
declared for backward compatibility, ignored. Please remove it.
define the Compose project name, until user defines one explicitly.
compose sub-projects to be included.
The services that will be used by your application.
Language models that will be used by your application.
Networks that are shared among multiple services.
Named volumes that are shared among multiple services.
Secrets that are shared among multiple services.
Configurations that are shared among multiple services.
Definitions
Configuration for a service.
Development configuration for the service, used for development workflows.
1 nested properties
Configure watch mode for the service, which monitors file changes and performs actions in response.
Deployment configuration for the service.
9 nested properties
Deployment mode for the service: 'replicated' (default) or 'global'.
Endpoint mode for the service: 'vip' (default) or 'dnsrr'.
Number of replicas of the service container to run.
Either a dictionary mapping keys to values, or a list of strings.
Configuration for rolling back a service update.
6 nested properties
The number of containers to rollback at a time. If set to 0, all containers rollback simultaneously.
The time to wait between each container group's rollback (e.g., '1s', '1m30s').
Action to take if a rollback fails: 'continue', 'pause'.
Duration to monitor each task for failures after it is created (e.g., '1s', '1m30s').
Failure rate to tolerate during a rollback.
Order of operations during rollbacks: 'stop-first' (default) or 'start-first'.
Configuration for updating a service.
6 nested properties
The number of containers to update at a time.
The time to wait between updating a group of containers (e.g., '1s', '1m30s').
Action to take if an update fails: 'continue', 'pause', 'rollback'.
Duration to monitor each updated task for failures after it is created (e.g., '1s', '1m30s').
Failure rate to tolerate during an update (0 to 1).
Order of operations during updates: 'stop-first' (default) or 'start-first'.
Resource constraints and reservations for the service.
2 nested properties
Resource limits for the service containers.
Resource reservations for the service containers.
Restart policy for the service containers.
4 nested properties
Condition for restarting the container: 'none', 'on-failure', 'any'.
Delay between restart attempts (e.g., '1s', '1m30s').
Maximum number of restart attempts before giving up.
Time window used to evaluate the restart policy (e.g., '1s', '1m30s').
Constraints and preferences for the platform to select a physical node to run service containers
3 nested properties
Placement constraints for the service (e.g., 'node.role==manager').
Placement preferences for the service.
Maximum number of replicas of the service.
Either a dictionary mapping keys to values, or a list of strings.
Configuration options for building the service's image.
Block IO configuration for the service.
6 nested properties
Limit read rate (bytes per second) from a device.
Limit read rate (IO per second) from a device.
Limit write rate (bytes per second) to a device.
Limit write rate (IO per second) to a device.
Block IO weight (relative weight) for the service, between 10 and 1000.
Block IO weight (relative weight) for specific devices.
Add Linux capabilities. For example, 'CAP_SYS_ADMIN', 'SYS_ADMIN', or 'NET_ADMIN'.
Drop Linux capabilities. For example, 'CAP_SYS_ADMIN', 'SYS_ADMIN', or 'NET_ADMIN'.
Specify the cgroup namespace to join. Use 'host' to use the host's cgroup namespace, or 'private' to use a private cgroup namespace.
Specify an optional parent cgroup for the container.
Command to run in the container, which can be specified as a string (shell form) or array (exec form).
Configuration for service configs or secrets, defining how they are mounted in the container.
Specify a custom container name, rather than a generated default name.
Number of usable CPUs.
Percentage of CPU resources to use.
CPU shares (relative weight) for the container.
Limit the CPU CFS (Completely Fair Scheduler) quota.
Limit the CPU CFS (Completely Fair Scheduler) period.
Limit the CPU real-time period in microseconds or a duration.
Limit the CPU real-time runtime in microseconds or a duration.
Number of CPUs to use. A floating-point value is supported to request partial CPUs.
CPUs in which to allow execution (0-3, 0,1).
Configure the credential spec for managed service account.
3 nested properties
The name of the credential spec Config to use.
Path to a credential spec file.
Path to a credential spec in the Windows registry.
Express dependency between services. Service dependencies cause services to be started in dependency order. The dependent service will wait for the dependency to be ready before starting.
List of device mappings for the container.
Either a single string or a list of strings.
Custom DNS options to be passed to the container's DNS resolver.
Either a single string or a list of strings.
Custom domain name to use for the service container.
Command to run in the container, which can be specified as a string (shell form) or array (exec form).
Either a dictionary mapping keys to values, or a list of strings.
Expose ports without publishing them to the host machine - they'll only be accessible to linked services.
Extend another service, in the current file or another file.
Specify a service which will not be manage by Compose directly, and delegate its management to an external provider.
2 nested properties
External component used by Compose to manage setup and teardown lifecycle of the service.
Provider-specific options.
Link to services started outside this Compose application. Specify services as <service_name>:
Additional hostnames to be defined in the container's /etc/hosts file.
Add additional groups which user inside the container should be member of.
Configuration options to determine whether the container is healthy.
7 nested properties
Disable any container-specified healthcheck. Set to true to disable.
Time between running the check (e.g., '1s', '1m30s'). Default: 30s.
Number of consecutive failures needed to consider the container as unhealthy. Default: 3.
The test to perform to check container health. Can be a string or a list. The first item is either NONE, CMD, or CMD-SHELL. If it's CMD, the rest of the command is exec'd. If it's CMD-SHELL, the rest is run in the shell.
Maximum time to allow one check to run (e.g., '1s', '1m30s'). Default: 30s.
Start period for the container to initialize before starting health-retries countdown (e.g., '1s', '1m30s'). Default: 0s.
Time between running the check during the start period (e.g., '1s', '1m30s'). Default: interval value.
Define a custom hostname for the service container.
Specify the image to start the container from. Can be a repository/tag, a digest, or a local image ID.
Run as an init process inside the container that forwards signals and reaps processes.
IPC sharing mode for the service container. Use 'host' to share the host's IPC namespace, 'service:[service_name]' to share with another service, or 'shareable' to allow other services to share this service's IPC namespace.
Container isolation technology to use. Supported values are platform-specific.
Either a dictionary mapping keys to values, or a list of strings.
Link to containers in another service. Either specify both the service name and a link alias (SERVICE:ALIAS), or just the service name.
Logging configuration for the service.
2 nested properties
Logging driver to use, such as 'json-file', 'syslog', 'journald', etc.
Options for the logging driver.
Container MAC address to set.
Memory limit for the container. A string value can use suffix like '2g' for 2 gigabytes.
Memory reservation for the container.
Container memory swappiness as percentage (0 to 100).
Amount of memory the container is allowed to swap to disk. Set to -1 to enable unlimited swap.
Network mode. Values can be 'bridge', 'host', 'none', 'service:[service name]', or 'container:[container name]'.
AI Models to use, referencing entries under the top-level models key.
Networks to join, referencing entries under the top-level networks key. Can be a list of network names or a mapping of network name to network configuration.
Disable OOM Killer for the container.
Tune host's OOM preferences for the container (accepts -1000 to 1000).
PID mode for container.
Tune a container's PIDs limit. Set to -1 for unlimited PIDs.
Target platform to run on, e.g., 'linux/amd64', 'linux/arm64', or 'windows/amd64'.
Expose container ports. Short format ([HOST:]CONTAINER[/PROTOCOL]).
Commands to run after the container starts. If any command fails, the container stops.
Commands to run before the container stops. If any command fails, the container stop is aborted.
Give extended privileges to the service container.
Policy for pulling images. Options include: 'always', 'never', 'if_not_present', 'missing', 'build', or time-based refresh policies.
Time after which to refresh the image. Used with pull_policy=refresh.
Mount the container's filesystem as read only.
Restart policy for the service container. Options include: 'no', 'always', 'on-failure', and 'unless-stopped'.
Runtime to use for this container, e.g., 'runc'.
Number of containers to deploy for this service.
Override the default labeling scheme for each container.
Size of /dev/shm. A string value can use suffix like '2g' for 2 gigabytes.
Configuration for service configs or secrets, defining how they are mounted in the container.
Either a dictionary mapping keys to values, or a list of strings.
Keep STDIN open even if not attached.
Time to wait for the container to stop gracefully before sending SIGKILL (e.g., '1s', '1m30s').
Signal to stop the container (e.g., 'SIGTERM', 'SIGINT').
Storage driver options for the container.
Either a single string or a list of strings.
Allocate a pseudo-TTY to service container.
Container ulimit options, controlling resource limits for processes inside the container.
Bind mount Docker API socket and required auth.
Username or UID to run the container process as.
UTS namespace to use. 'host' shares the host's UTS namespace.
User namespace to use. 'host' shares the host's user namespace.
Mount host paths or named volumes accessible to the container. Short syntax (VOLUME:CONTAINER_PATH[:MODE])
Mount volumes from another service or container. Optionally specify read-only access (ro) or read-write (rw).
The working directory in which the entrypoint or command will be run
Configuration options to determine whether the container is healthy.
Disable any container-specified healthcheck. Set to true to disable.
Time between running the check (e.g., '1s', '1m30s'). Default: 30s.
Number of consecutive failures needed to consider the container as unhealthy. Default: 3.
The test to perform to check container health. Can be a string or a list. The first item is either NONE, CMD, or CMD-SHELL. If it's CMD, the rest of the command is exec'd. If it's CMD-SHELL, the rest is run in the shell.
Maximum time to allow one check to run (e.g., '1s', '1m30s'). Default: 30s.
Start period for the container to initialize before starting health-retries countdown (e.g., '1s', '1m30s'). Default: 0s.
Time between running the check during the start period (e.g., '1s', '1m30s'). Default: interval value.
Development configuration for the service, used for development workflows.
Configure watch mode for the service, which monitors file changes and performs actions in response.
Deployment configuration for the service.
Deployment mode for the service: 'replicated' (default) or 'global'.
Endpoint mode for the service: 'vip' (default) or 'dnsrr'.
Number of replicas of the service container to run.
Either a dictionary mapping keys to values, or a list of strings.
Configuration for rolling back a service update.
6 nested properties
The number of containers to rollback at a time. If set to 0, all containers rollback simultaneously.
The time to wait between each container group's rollback (e.g., '1s', '1m30s').
Action to take if a rollback fails: 'continue', 'pause'.
Duration to monitor each task for failures after it is created (e.g., '1s', '1m30s').
Failure rate to tolerate during a rollback.
Order of operations during rollbacks: 'stop-first' (default) or 'start-first'.
Configuration for updating a service.
6 nested properties
The number of containers to update at a time.
The time to wait between updating a group of containers (e.g., '1s', '1m30s').
Action to take if an update fails: 'continue', 'pause', 'rollback'.
Duration to monitor each updated task for failures after it is created (e.g., '1s', '1m30s').
Failure rate to tolerate during an update (0 to 1).
Order of operations during updates: 'stop-first' (default) or 'start-first'.
Resource constraints and reservations for the service.
2 nested properties
Resource limits for the service containers.
3 nested properties
Limit for how much of the available CPU resources, as number of cores, a container can use.
Limit on the amount of memory a container can allocate (e.g., '1g', '1024m').
Maximum number of PIDs available to the container.
Resource reservations for the service containers.
4 nested properties
Reservation for how much of the available CPU resources, as number of cores, a container can use.
Reservation on the amount of memory a container can allocate (e.g., '1g', '1024m').
User-defined resources for services, allowing services to reserve specialized hardware resources.
Device reservations for containers, allowing services to access specific hardware devices.
Restart policy for the service containers.
4 nested properties
Condition for restarting the container: 'none', 'on-failure', 'any'.
Delay between restart attempts (e.g., '1s', '1m30s').
Maximum number of restart attempts before giving up.
Time window used to evaluate the restart policy (e.g., '1s', '1m30s').
Constraints and preferences for the platform to select a physical node to run service containers
3 nested properties
Placement constraints for the service (e.g., 'node.role==manager').
Placement preferences for the service.
Maximum number of replicas of the service.
User-defined resources for services, allowing services to reserve specialized hardware resources.
Device reservations for containers, allowing services to access specific hardware devices.
Compose application or sub-projects to be included.
Network configuration for the Compose application.
Custom name for this network.
Specify which driver should be used for this network. Default is 'bridge'.
Specify driver-specific options defined as key/value pairs.
Custom IP Address Management configuration for this network.
3 nested properties
Custom IPAM driver, instead of the default.
List of IPAM configuration blocks.
Driver-specific options for the IPAM driver.
Specifies that this network already exists and was created outside of Compose.
1 nested properties
Specifies the name of the external network. Deprecated: use the 'name' property instead.
Create an externally isolated network.
Enable IPv4 networking.
Enable IPv6 networking.
If true, standalone containers can attach to this network.
Either a dictionary mapping keys to values, or a list of strings.
Volume configuration for the Compose application.
Custom name for this volume.
Specify which volume driver should be used for this volume.
Specify driver-specific options.
Specifies that this volume already exists and was created outside of Compose.
1 nested properties
Specifies the name of the external volume. Deprecated: use the 'name' property instead.
Either a dictionary mapping keys to values, or a list of strings.
Secret configuration for the Compose application.
Custom name for this secret.
Name of an environment variable from which to get the secret value.
Path to a file containing the secret value.
Specifies that this secret already exists and was created outside of Compose.
1 nested properties
Specifies the name of the external secret.
Either a dictionary mapping keys to values, or a list of strings.
Specify which secret driver should be used for this secret.
Specify driver-specific options.
Driver to use for templating the secret's value.
Config configuration for the Compose application.
Custom name for this config.
Inline content of the config.
Name of an environment variable from which to get the config value.
Path to a file containing the config value.
Specifies that this config already exists and was created outside of Compose.
1 nested properties
Specifies the name of the external config. Deprecated: use the 'name' property instead.
Either a dictionary mapping keys to values, or a list of strings.
Driver to use for templating the config's value.
Language Model for the Compose application.
Language Model to run.
Custom name for this model.
Raw runtime flags to pass to the inference engine.
Command to run in the container, which can be specified as a string (shell form) or array (exec form).
Configuration for service lifecycle hooks, which are commands executed at specific points in a container's lifecycle.
Command to run in the container, which can be specified as a string (shell form) or array (exec form).
User to run the command as.
Whether to run the command with extended privileges.
Working directory for the command.
Either a dictionary mapping keys to values, or a list of strings.
Either a single string or a list of strings.
A list of unique string values.
Either a dictionary mapping keys to values, or a list of strings.
Additional hostnames to be defined in the container's /etc/hosts file.
Block IO limit for a specific device.
Path to the device (e.g., '/dev/sda').
Rate limit in bytes per second or IO operations per second.
Block IO weight for a specific device.
Path to the device (e.g., '/dev/sda').
Relative weight for the device, between 10 and 1000.
Configuration for service configs or secrets, defining how they are mounted in the container.
Container ulimit options, controlling resource limits for processes inside the container.