{
"$schema": "http://json-schema.org/draft/2019-09/schema#",
"id": "compose_spec.json",
"type": "object",
"title": "Compose Specification",
"description": "The Compose file is a YAML file defining a multi-containers based application.",
"properties": {
"version": {
"type": "string",
"description": "declared for backward compatibility, ignored."
},
"name": {
"description": "define the Compose project name, until user defines one explicitly."
"services": {
"id": "#/properties/services",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/service"
}
"additionalProperties": false
"networks": {
"id": "#/properties/networks",
"$ref": "#/definitions/network"
"volumes": {
"id": "#/properties/volumes",
"$ref": "#/definitions/volume"
"secrets": {
"id": "#/properties/secrets",
"$ref": "#/definitions/secret"
"configs": {
"id": "#/properties/configs",
"$ref": "#/definitions/config"
"patternProperties": {"^x-": {}},
"additionalProperties": false,
"definitions": {
"service": {
"id": "#/definitions/service",
"deploy": {"$ref": "#/definitions/deployment"},
"build": {
"oneOf": [
{"type": "string"},
"context": {"type": "string"},
"dockerfile": {"type": "string"},
"args": {"$ref": "#/definitions/list_or_dict"},
"ssh": {"$ref": "#/definitions/list_or_dict"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"cache_from": {"type": "array", "items": {"type": "string"}},
"cache_to": {"type": "array", "items": {"type": "string"}},
"no_cache": {"type": "boolean"},
"network": {"type": "string"},
"pull": {"type": "boolean"},
"target": {"type": "string"},
"shm_size": {"type": ["integer", "string"]},
"extra_hosts": {"$ref": "#/definitions/list_or_dict"},
"isolation": {"type": "string"},
"secrets": {"$ref": "#/definitions/service_config_or_secret"},
"tags": {"type": "array", "items": {"type": "string"}},
"platforms": {"type": "array", "items": {"type": "string"}}
"patternProperties": {"^x-": {}}
]
"blkio_config": {
"device_read_bps": {
"type": "array",
"items": {"$ref": "#/definitions/blkio_limit"}
"device_read_iops": {
"device_write_bps": {
"device_write_iops": {
"weight": {"type": "integer"},
"weight_device": {
"items": {"$ref": "#/definitions/blkio_weight"}
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cgroup_parent": {"type": "string"},
"command": {
{"type": "array", "items": {"type": "string"}}
"configs": {"$ref": "#/definitions/service_config_or_secret"},
"container_name": {"type": "string"},
"cpu_count": {"type": "integer", "minimum": 0},
"cpu_percent": {"type": "integer", "minimum": 0, "maximum": 100},
"cpu_shares": {"type": ["number", "string"]},
"cpu_quota": {"type": ["number", "string"]},
"cpu_period": {"type": ["number", "string"]},
"cpu_rt_period": {"type": ["number", "string"]},
"cpu_rt_runtime": {"type": ["number", "string"]},
"cpus": {"type": ["number", "string"]},
"cpuset": {"type": "string"},
"credential_spec": {
"config": {"type": "string"},
"file": {"type": "string"},
"registry": {"type": "string"}
"depends_on": {
{"$ref": "#/definitions/list_of_strings"},
"condition": {
"enum": ["service_started", "service_healthy", "service_completed_successfully"]
"required": ["condition"]
"device_cgroup_rules": {"$ref": "#/definitions/list_of_strings"},
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"dns": {"$ref": "#/definitions/string_or_list"},
"dns_opt": {"type": "array","items": {"type": "string"}, "uniqueItems": true},
"dns_search": {"$ref": "#/definitions/string_or_list"},
"domainname": {"type": "string"},
"entrypoint": {
"env_file": {"$ref": "#/definitions/string_or_list"},
"environment": {"$ref": "#/definitions/list_or_dict"},
"expose": {
"items": {
"type": ["string", "number"],
"format": "expose"
"uniqueItems": true
"extends": {
"service": {"type": "string"},
"file": {"type": "string"}
"required": ["service"],
"external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"group_add": {
"type": ["string", "number"]
"healthcheck": {"$ref": "#/definitions/healthcheck"},
"hostname": {"type": "string"},
"image": {"type": "string"},
"init": {"type": "boolean"},
"ipc": {"type": "string"},
"links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"logging": {
"driver": {"type": "string"},
"options": {
"^.+$": {"type": ["string", "number", "null"]}
"mac_address": {"type": "string"},
"mem_limit": {"type": ["number", "string"]},
"mem_reservation": {"type": ["string", "integer"]},
"mem_swappiness": {"type": "integer"},
"memswap_limit": {"type": ["number", "string"]},
"network_mode": {"type": "string"},
"aliases": {"$ref": "#/definitions/list_of_strings"},
"ipv4_address": {"type": "string"},
"ipv6_address": {"type": "string"},
"link_local_ips": {"$ref": "#/definitions/list_of_strings"},
"priority": {"type": "number"}
{"type": "null"}
"oom_kill_disable": {"type": "boolean"},
"oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
"pid": {"type": ["string", "null"]},
"pids_limit": {"type": ["number", "string"]},
"platform": {"type": "string"},
"ports": {
{"type": "number", "format": "ports"},
{"type": "string", "format": "ports"},
"mode": {"type": "string"},
"host_ip": {"type": "string"},
"target": {"type": "integer"},
"published": {"type": ["string", "integer"]},
"protocol": {"type": "string"}
"privileged": {"type": "boolean"},
"profiles": {"$ref": "#/definitions/list_of_strings"},
"pull_policy": {"type": "string", "enum": [
"always", "never", "if_not_present", "build", "missing"
]},
"read_only": {"type": "boolean"},
"restart": {"type": "string"},
"runtime": {
"type": "string"
"scale": {
"type": "integer"
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"shm_size": {"type": ["number", "string"]},
"sysctls": {"$ref": "#/definitions/list_or_dict"},
"stdin_open": {"type": "boolean"},
"stop_grace_period": {"type": "string", "format": "duration"},
"stop_signal": {"type": "string"},
"storage_opt": {"type": "object"},
"tmpfs": {"$ref": "#/definitions/string_or_list"},
"tty": {"type": "boolean"},
"ulimits": {
"^[a-z]+$": {
{"type": "integer"},
"hard": {"type": "integer"},
"soft": {"type": "integer"}
"required": ["soft", "hard"],
"user": {"type": "string"},
"userns_mode": {"type": "string"},
"required": ["type"],
"type": {"type": "string"},
"source": {"type": "string"},
"consistency": {"type": "string"},
"bind": {
"propagation": {"type": "string"},
"create_host_path": {"type": "boolean"},
"selinux": {"type": "string", "enum": ["z", "Z"]}
"volume": {
"nocopy": {"type": "boolean"}
"tmpfs": {
"size": {
{"type": "integer", "minimum": 0},
{"type": "string"}
"volumes_from": {
"items": {"type": "string"},
"working_dir": {"type": "string"}
"healthcheck": {
"id": "#/definitions/healthcheck",
"disable": {"type": "boolean"},
"interval": {"type": "string", "format": "duration"},
"retries": {"type": "number"},
"test": {
"timeout": {"type": "string", "format": "duration"},
"start_period": {"type": "string", "format": "duration"}
"deployment": {
"id": "#/definitions/deployment",
"type": ["object", "null"],
"endpoint_mode": {"type": "string"},
"replicas": {"type": "integer"},
"rollback_config": {
"parallelism": {"type": "integer"},
"delay": {"type": "string", "format": "duration"},
"failure_action": {"type": "string"},
"monitor": {"type": "string", "format": "duration"},
"max_failure_ratio": {"type": "number"},
"order": {"type": "string", "enum": [
"start-first", "stop-first"
]}
"update_config": {
"resources": {
"limits": {
"memory": {"type": "string"},
"pids": {"type": "integer"}
"reservations": {
"generic_resources": {"$ref": "#/definitions/generic_resources"},
"devices": {"$ref": "#/definitions/devices"}
"restart_policy": {
"condition": {"type": "string"},
"max_attempts": {"type": "integer"},
"window": {"type": "string", "format": "duration"}
"placement": {
"constraints": {"type": "array", "items": {"type": "string"}},
"preferences": {
"spread": {"type": "string"}
"max_replicas_per_node": {"type": "integer"}
"generic_resources": {
"id": "#/definitions/generic_resources",
"discrete_resource_spec": {
"kind": {"type": "string"},
"value": {"type": "number"}
"devices": {
"id": "#/definitions/devices",
"capabilities": {"$ref": "#/definitions/list_of_strings"},
"count": {"type": ["string", "integer"]},
"device_ids": {"$ref": "#/definitions/list_of_strings"},
"driver":{"type": "string"},
"options":{"$ref": "#/definitions/list_or_dict"}
"network": {
"id": "#/definitions/network",
"name": {"type": "string"},
"driver_opts": {
"^.+$": {"type": ["string", "number"]}
"ipam": {
"config": {
"subnet": {"type": "string", "format": "subnet_ip_address"},
"ip_range": {"type": "string"},
"gateway": {"type": "string"},
"aux_addresses": {
"patternProperties": {"^.+$": {"type": "string"}}
"external": {
"type": ["boolean", "object"],
"deprecated": true,
"internal": {"type": "boolean"},
"enable_ipv6": {"type": "boolean"},
"attachable": {"type": "boolean"},
"labels": {"$ref": "#/definitions/list_or_dict"}
"id": "#/definitions/volume",
"secret": {
"id": "#/definitions/secret",
"environment": {"type": "string"},
"name": {"type": "string"}
"template_driver": {"type": "string"}
"id": "#/definitions/config",
"string_or_list": {
{"$ref": "#/definitions/list_of_strings"}
"list_of_strings": {
"list_or_dict": {
".+": {
"type": ["string", "number", "boolean", "null"]
{"type": "array", "items": {"type": "string"}, "uniqueItems": true}
"blkio_limit": {
"path": {"type": "string"},
"rate": {"type": ["integer", "string"]}
"blkio_weight": {
"weight": {"type": "integer"}
"service_config_or_secret": {
"uid": {"type": "string"},
"gid": {"type": "string"},
"mode": {"type": "number"}
"constraints": {
"id": "#/definitions/constraints/service",
"anyOf": [
{"required": ["build"]},
{"required": ["image"]}
],
"required": ["context"]