1{ 2 "$schema": "http://json-schema.org/draft-04/schema#", 3 "id": "config_schema_v3.3.json", 4 "type": "object", 5 "required": ["version"], 6 7 "properties": { 8 "version": { 9 "type": "string" 10 }, 11 12 "services": { 13 "id": "#/properties/services", 14 "type": "object", 15 "patternProperties": { 16 "^[a-zA-Z0-9._-]+$": { 17 "$ref": "#/definitions/service" 18 } 19 }, 20 "additionalProperties": false 21 }, 22 23 "networks": { 24 "id": "#/properties/networks", 25 "type": "object", 26 "patternProperties": { 27 "^[a-zA-Z0-9._-]+$": { 28 "$ref": "#/definitions/network" 29 } 30 } 31 }, 32 33 "volumes": { 34 "id": "#/properties/volumes", 35 "type": "object", 36 "patternProperties": { 37 "^[a-zA-Z0-9._-]+$": { 38 "$ref": "#/definitions/volume" 39 } 40 }, 41 "additionalProperties": false 42 }, 43 44 "secrets": { 45 "id": "#/properties/secrets", 46 "type": "object", 47 "patternProperties": { 48 "^[a-zA-Z0-9._-]+$": { 49 "$ref": "#/definitions/secret" 50 } 51 }, 52 "additionalProperties": false 53 }, 54 55 "configs": { 56 "id": "#/properties/configs", 57 "type": "object", 58 "patternProperties": { 59 "^[a-zA-Z0-9._-]+$": { 60 "$ref": "#/definitions/config" 61 } 62 }, 63 "additionalProperties": false 64 } 65 }, 66 67 "additionalProperties": false, 68 69 "definitions": { 70 71 "service": { 72 "id": "#/definitions/service", 73 "type": "object", 74 75 "properties": { 76 "deploy": {"$ref": "#/definitions/deployment"}, 77 "build": { 78 "oneOf": [ 79 {"type": "string"}, 80 { 81 "type": "object", 82 "properties": { 83 "context": {"type": "string"}, 84 "dockerfile": {"type": "string"}, 85 "args": {"$ref": "#/definitions/list_or_dict"}, 86 "labels": {"$ref": "#/definitions/labels"}, 87 "cache_from": {"$ref": "#/definitions/list_of_strings"} 88 }, 89 "additionalProperties": false 90 } 91 ] 92 }, 93 "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 94 "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 95 "cgroup_parent": {"type": "string"}, 96 "command": { 97 "oneOf": [ 98 {"type": "string"}, 99 {"type": "array", "items": {"type": "string"}} 100 ] 101 }, 102 "configs": { 103 "type": "array", 104 "items": { 105 "oneOf": [ 106 {"type": "string"}, 107 { 108 "type": "object", 109 "properties": { 110 "source": {"type": "string"}, 111 "target": {"type": "string"}, 112 "uid": {"type": "string"}, 113 "gid": {"type": "string"}, 114 "mode": {"type": "number"} 115 } 116 } 117 ] 118 } 119 }, 120 "container_name": {"type": "string"}, 121 "credential_spec": {"type": "object", "properties": { 122 "file": {"type": "string"}, 123 "registry": {"type": "string"} 124 }}, 125 "depends_on": {"$ref": "#/definitions/list_of_strings"}, 126 "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 127 "dns": {"$ref": "#/definitions/string_or_list"}, 128 "dns_search": {"$ref": "#/definitions/string_or_list"}, 129 "domainname": {"type": "string"}, 130 "entrypoint": { 131 "oneOf": [ 132 {"type": "string"}, 133 {"type": "array", "items": {"type": "string"}} 134 ] 135 }, 136 "env_file": {"$ref": "#/definitions/string_or_list"}, 137 "environment": {"$ref": "#/definitions/list_or_dict"}, 138 139 "expose": { 140 "type": "array", 141 "items": { 142 "type": ["string", "number"], 143 "format": "expose" 144 }, 145 "uniqueItems": true 146 }, 147 148 "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 149 "extra_hosts": {"$ref": "#/definitions/list_or_dict"}, 150 "healthcheck": {"$ref": "#/definitions/healthcheck"}, 151 "hostname": {"type": "string"}, 152 "image": {"type": "string"}, 153 "ipc": {"type": "string"}, 154 "labels": {"$ref": "#/definitions/labels"}, 155 "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 156 157 "logging": { 158 "type": "object", 159 160 "properties": { 161 "driver": {"type": "string"}, 162 "options": { 163 "type": "object", 164 "patternProperties": { 165 "^.+$": {"type": ["string", "number", "null"]} 166 } 167 } 168 }, 169 "additionalProperties": false 170 }, 171 172 "mac_address": {"type": "string"}, 173 "network_mode": {"type": "string"}, 174 175 "networks": { 176 "oneOf": [ 177 {"$ref": "#/definitions/list_of_strings"}, 178 { 179 "type": "object", 180 "patternProperties": { 181 "^[a-zA-Z0-9._-]+$": { 182 "oneOf": [ 183 { 184 "type": "object", 185 "properties": { 186 "aliases": {"$ref": "#/definitions/list_of_strings"}, 187 "ipv4_address": {"type": "string"}, 188 "ipv6_address": {"type": "string"} 189 }, 190 "additionalProperties": false 191 }, 192 {"type": "null"} 193 ] 194 } 195 }, 196 "additionalProperties": false 197 } 198 ] 199 }, 200 "pid": {"type": ["string", "null"]}, 201 202 "ports": { 203 "type": "array", 204 "items": { 205 "oneOf": [ 206 {"type": "number", "format": "ports"}, 207 {"type": "string", "format": "ports"}, 208 { 209 "type": "object", 210 "properties": { 211 "mode": {"type": "string"}, 212 "target": {"type": "integer"}, 213 "published": {"type": "integer"}, 214 "protocol": {"type": "string"} 215 }, 216 "additionalProperties": false 217 } 218 ] 219 }, 220 "uniqueItems": true 221 }, 222 223 "privileged": {"type": "boolean"}, 224 "read_only": {"type": "boolean"}, 225 "restart": {"type": "string"}, 226 "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 227 "shm_size": {"type": ["number", "string"]}, 228 "secrets": { 229 "type": "array", 230 "items": { 231 "oneOf": [ 232 {"type": "string"}, 233 { 234 "type": "object", 235 "properties": { 236 "source": {"type": "string"}, 237 "target": {"type": "string"}, 238 "uid": {"type": "string"}, 239 "gid": {"type": "string"}, 240 "mode": {"type": "number"} 241 } 242 } 243 ] 244 } 245 }, 246 "sysctls": {"$ref": "#/definitions/list_or_dict"}, 247 "stdin_open": {"type": "boolean"}, 248 "stop_grace_period": {"type": "string", "format": "duration"}, 249 "stop_signal": {"type": "string"}, 250 "tmpfs": {"$ref": "#/definitions/string_or_list"}, 251 "tty": {"type": "boolean"}, 252 "ulimits": { 253 "type": "object", 254 "patternProperties": { 255 "^[a-z]+$": { 256 "oneOf": [ 257 {"type": "integer"}, 258 { 259 "type":"object", 260 "properties": { 261 "hard": {"type": "integer"}, 262 "soft": {"type": "integer"} 263 }, 264 "required": ["soft", "hard"], 265 "additionalProperties": false 266 } 267 ] 268 } 269 } 270 }, 271 "user": {"type": "string"}, 272 "userns_mode": {"type": "string"}, 273 "volumes": { 274 "type": "array", 275 "items": { 276 "oneOf": [ 277 {"type": "string"}, 278 { 279 "type": "object", 280 "required": ["type"], 281 "additionalProperties": false, 282 "properties": { 283 "type": {"type": "string"}, 284 "source": {"type": "string"}, 285 "target": {"type": "string"}, 286 "read_only": {"type": "boolean"}, 287 "consistency": {"type": "string"}, 288 "bind": { 289 "type": "object", 290 "properties": { 291 "propagation": {"type": "string"} 292 } 293 }, 294 "volume": { 295 "type": "object", 296 "properties": { 297 "nocopy": {"type": "boolean"} 298 } 299 } 300 } 301 } 302 ], 303 "uniqueItems": true 304 } 305 }, 306 "working_dir": {"type": "string"} 307 }, 308 "additionalProperties": false 309 }, 310 311 "healthcheck": { 312 "id": "#/definitions/healthcheck", 313 "type": "object", 314 "additionalProperties": false, 315 "properties": { 316 "disable": {"type": "boolean"}, 317 "interval": {"type": "string"}, 318 "retries": {"type": "number"}, 319 "test": { 320 "oneOf": [ 321 {"type": "string"}, 322 {"type": "array", "items": {"type": "string"}} 323 ] 324 }, 325 "timeout": {"type": "string"} 326 } 327 }, 328 "deployment": { 329 "id": "#/definitions/deployment", 330 "type": ["object", "null"], 331 "properties": { 332 "mode": {"type": "string"}, 333 "endpoint_mode": {"type": "string"}, 334 "replicas": {"type": "integer"}, 335 "labels": {"$ref": "#/definitions/labels"}, 336 "update_config": { 337 "type": "object", 338 "properties": { 339 "parallelism": {"type": "integer"}, 340 "delay": {"type": "string", "format": "duration"}, 341 "failure_action": {"type": "string"}, 342 "monitor": {"type": "string", "format": "duration"}, 343 "max_failure_ratio": {"type": "number"} 344 }, 345 "additionalProperties": false 346 }, 347 "resources": { 348 "type": "object", 349 "properties": { 350 "limits": {"$ref": "#/definitions/resource"}, 351 "reservations": {"$ref": "#/definitions/resource"} 352 }, 353 "additionalProperties": false 354 }, 355 "restart_policy": { 356 "type": "object", 357 "properties": { 358 "condition": {"type": "string"}, 359 "delay": {"type": "string", "format": "duration"}, 360 "max_attempts": {"type": "integer"}, 361 "window": {"type": "string", "format": "duration"} 362 }, 363 "additionalProperties": false 364 }, 365 "placement": { 366 "type": "object", 367 "properties": { 368 "constraints": {"type": "array", "items": {"type": "string"}}, 369 "preferences": { 370 "type": "array", 371 "items": { 372 "type": "object", 373 "properties": { 374 "spread": {"type": "string"} 375 }, 376 "additionalProperties": false 377 } 378 } 379 }, 380 "additionalProperties": false 381 } 382 }, 383 "additionalProperties": false 384 }, 385 386 "resource": { 387 "id": "#/definitions/resource", 388 "type": "object", 389 "properties": { 390 "cpus": {"type": "string"}, 391 "memory": {"type": "string"} 392 }, 393 "additionalProperties": false 394 }, 395 396 "network": { 397 "id": "#/definitions/network", 398 "type": ["object", "null"], 399 "properties": { 400 "driver": {"type": "string"}, 401 "driver_opts": { 402 "type": "object", 403 "patternProperties": { 404 "^.+$": {"type": ["string", "number"]} 405 } 406 }, 407 "ipam": { 408 "type": "object", 409 "properties": { 410 "driver": {"type": "string"}, 411 "config": { 412 "type": "array", 413 "items": { 414 "type": "object", 415 "properties": { 416 "subnet": {"type": "string", "format": "subnet_ip_address"} 417 }, 418 "additionalProperties": false 419 } 420 } 421 }, 422 "additionalProperties": false 423 }, 424 "external": { 425 "type": ["boolean", "object"], 426 "properties": { 427 "name": {"type": "string"} 428 }, 429 "additionalProperties": false 430 }, 431 "internal": {"type": "boolean"}, 432 "attachable": {"type": "boolean"}, 433 "labels": {"$ref": "#/definitions/labels"} 434 }, 435 "additionalProperties": false 436 }, 437 438 "volume": { 439 "id": "#/definitions/volume", 440 "type": ["object", "null"], 441 "properties": { 442 "driver": {"type": "string"}, 443 "driver_opts": { 444 "type": "object", 445 "patternProperties": { 446 "^.+$": {"type": ["string", "number"]} 447 } 448 }, 449 "external": { 450 "type": ["boolean", "object"], 451 "properties": { 452 "name": {"type": "string"} 453 }, 454 "additionalProperties": false 455 }, 456 "labels": {"$ref": "#/definitions/labels"} 457 }, 458 "additionalProperties": false 459 }, 460 461 "secret": { 462 "id": "#/definitions/secret", 463 "type": "object", 464 "properties": { 465 "file": {"type": "string"}, 466 "external": { 467 "type": ["boolean", "object"], 468 "properties": { 469 "name": {"type": "string"} 470 } 471 }, 472 "labels": {"$ref": "#/definitions/labels"} 473 }, 474 "additionalProperties": false 475 }, 476 477 "config": { 478 "id": "#/definitions/config", 479 "type": "object", 480 "properties": { 481 "file": {"type": "string"}, 482 "external": { 483 "type": ["boolean", "object"], 484 "properties": { 485 "name": {"type": "string"} 486 } 487 }, 488 "labels": {"$ref": "#/definitions/labels"} 489 }, 490 "additionalProperties": false 491 }, 492 493 "string_or_list": { 494 "oneOf": [ 495 {"type": "string"}, 496 {"$ref": "#/definitions/list_of_strings"} 497 ] 498 }, 499 500 "list_of_strings": { 501 "type": "array", 502 "items": {"type": "string"}, 503 "uniqueItems": true 504 }, 505 506 "list_or_dict": { 507 "oneOf": [ 508 { 509 "type": "object", 510 "patternProperties": { 511 ".+": { 512 "type": ["string", "number", "null"] 513 } 514 }, 515 "additionalProperties": false 516 }, 517 {"type": "array", "items": {"type": "string"}, "uniqueItems": true} 518 ] 519 }, 520 521 "labels": { 522 "oneOf": [ 523 { 524 "type": "object", 525 "patternProperties": { 526 ".+": { 527 "type": "string" 528 } 529 }, 530 "additionalProperties": false 531 }, 532 {"type": "array", "items": {"type": "string"}, "uniqueItems": true} 533 ] 534 }, 535 536 "constraints": { 537 "service": { 538 "id": "#/definitions/constraints/service", 539 "anyOf": [ 540 {"required": ["build"]}, 541 {"required": ["image"]} 542 ], 543 "properties": { 544 "build": { 545 "required": ["context"] 546 } 547 } 548 } 549 } 550 } 551} 552