github.com/docker/libcompose@v0.4.1-0.20210616120443-2a046c0bdbf2/config/schema.go (about) 1 package config 2 3 var schemaDataV1 = `{ 4 "$schema": "http://json-schema.org/draft-04/schema#", 5 "id": "config_schema_v1.json", 6 7 "type": "object", 8 9 "patternProperties": { 10 "^[a-zA-Z0-9._-]+$": { 11 "$ref": "#/definitions/service" 12 } 13 }, 14 15 "additionalProperties": false, 16 17 "definitions": { 18 "service": { 19 "id": "#/definitions/service", 20 "type": "object", 21 22 "properties": { 23 "build": {"type": "string"}, 24 "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 25 "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 26 "cgroup_parent": {"type": "string"}, 27 "command": { 28 "oneOf": [ 29 {"type": "string"}, 30 {"type": "array", "items": {"type": "string"}} 31 ] 32 }, 33 "container_name": {"type": "string"}, 34 "cpu_shares": {"type": ["number", "string"]}, 35 "cpu_quota": {"type": ["number", "string"]}, 36 "cpuset": {"type": "string"}, 37 "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 38 "dns": {"$ref": "#/definitions/string_or_list"}, 39 "dns_search": {"$ref": "#/definitions/string_or_list"}, 40 "dockerfile": {"type": "string"}, 41 "domainname": {"type": "string"}, 42 "entrypoint": { 43 "oneOf": [ 44 {"type": "string"}, 45 {"type": "array", "items": {"type": "string"}} 46 ] 47 }, 48 "env_file": {"$ref": "#/definitions/string_or_list"}, 49 "environment": {"$ref": "#/definitions/list_or_dict"}, 50 51 "expose": { 52 "type": "array", 53 "items": { 54 "type": ["string", "number"], 55 "format": "expose" 56 }, 57 "uniqueItems": true 58 }, 59 60 "extends": { 61 "oneOf": [ 62 { 63 "type": "string" 64 }, 65 { 66 "type": "object", 67 68 "properties": { 69 "service": {"type": "string"}, 70 "file": {"type": "string"} 71 }, 72 "required": ["service"], 73 "additionalProperties": false 74 } 75 ] 76 }, 77 78 "extra_hosts": {"$ref": "#/definitions/list_or_dict"}, 79 "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 80 "hostname": {"type": "string"}, 81 "image": {"type": "string"}, 82 "ipc": {"type": "string"}, 83 "labels": {"$ref": "#/definitions/list_or_dict"}, 84 "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 85 "log_driver": {"type": "string"}, 86 "log_opt": {"type": "object"}, 87 "mac_address": {"type": "string"}, 88 "mem_limit": {"type": ["number", "string"]}, 89 "mem_reservation": {"type": ["number", "string"]}, 90 "memswap_limit": {"type": ["number", "string"]}, 91 "mem_swappiness": {"type": "integer"}, 92 "net": {"type": "string"}, 93 "pid": {"type": ["string", "null"]}, 94 95 "ports": { 96 "type": "array", 97 "items": { 98 "type": ["string", "number"], 99 "format": "ports" 100 }, 101 "uniqueItems": true 102 }, 103 104 "privileged": {"type": "boolean"}, 105 "read_only": {"type": "boolean"}, 106 "restart": {"type": "string"}, 107 "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 108 "shm_size": {"type": ["number", "string"]}, 109 "stdin_open": {"type": "boolean"}, 110 "stop_signal": {"type": "string"}, 111 "tty": {"type": "boolean"}, 112 "ulimits": { 113 "type": "object", 114 "patternProperties": { 115 "^[a-z]+$": { 116 "oneOf": [ 117 {"type": "integer"}, 118 { 119 "type":"object", 120 "properties": { 121 "hard": {"type": "integer"}, 122 "soft": {"type": "integer"} 123 }, 124 "required": ["soft", "hard"], 125 "additionalProperties": false 126 } 127 ] 128 } 129 } 130 }, 131 "user": {"type": "string"}, 132 "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 133 "volume_driver": {"type": "string"}, 134 "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 135 "working_dir": {"type": "string"} 136 }, 137 138 "dependencies": { 139 "memswap_limit": ["mem_limit"] 140 }, 141 "additionalProperties": false 142 }, 143 144 "string_or_list": { 145 "oneOf": [ 146 {"type": "string"}, 147 {"$ref": "#/definitions/list_of_strings"} 148 ] 149 }, 150 151 "list_of_strings": { 152 "type": "array", 153 "items": {"type": "string"}, 154 "uniqueItems": true 155 }, 156 157 "list_or_dict": { 158 "oneOf": [ 159 { 160 "type": "object", 161 "patternProperties": { 162 ".+": { 163 "type": ["string", "number", "null"] 164 } 165 }, 166 "additionalProperties": false 167 }, 168 {"type": "array", "items": {"type": "string"}, "uniqueItems": true} 169 ] 170 }, 171 172 "constraints": { 173 "service": { 174 "id": "#/definitions/constraints/service", 175 "anyOf": [ 176 { 177 "required": ["build"], 178 "not": {"required": ["image"]} 179 }, 180 { 181 "required": ["image"], 182 "not": {"anyOf": [ 183 {"required": ["build"]}, 184 {"required": ["dockerfile"]} 185 ]} 186 } 187 ] 188 } 189 } 190 } 191 } 192 ` 193 194 var servicesSchemaDataV2 = `{ 195 "$schema": "http://json-schema.org/draft-04/schema#", 196 "id": "config_schema_v2.0.json", 197 "type": "object", 198 199 "patternProperties": { 200 "^[a-zA-Z0-9._-]+$": { 201 "$ref": "#/definitions/service" 202 } 203 }, 204 205 "additionalProperties": false, 206 207 "definitions": { 208 209 "service": { 210 "id": "#/definitions/service", 211 "type": "object", 212 213 "properties": { 214 "build": { 215 "oneOf": [ 216 {"type": "string"}, 217 { 218 "type": "object", 219 "properties": { 220 "context": {"type": "string"}, 221 "dockerfile": {"type": "string"}, 222 "args": {"$ref": "#/definitions/list_or_dict"}, 223 "cache_from": {"$ref": "#/definitions/list_of_strings"}, 224 "labels": {"$ref": "#/definitions/list_or_dict"}, 225 "network": {"type": "string"}, 226 "target": {"type": "string"} 227 }, 228 "additionalProperties": false 229 } 230 ] 231 }, 232 "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 233 "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 234 "cgroup_parent": {"type": "string"}, 235 "command": { 236 "oneOf": [ 237 {"type": "string"}, 238 {"type": "array", "items": {"type": "string"}} 239 ] 240 }, 241 "container_name": {"type": "string"}, 242 "cpu_shares": {"type": ["number", "string"]}, 243 "cpu_quota": {"type": ["number", "string"]}, 244 "cpuset": {"type": "string"}, 245 "depends_on": {"$ref": "#/definitions/list_of_strings"}, 246 "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 247 "dns": {"$ref": "#/definitions/string_or_list"}, 248 "dns_search": {"$ref": "#/definitions/string_or_list"}, 249 "domainname": {"type": "string"}, 250 "entrypoint": { 251 "oneOf": [ 252 {"type": "string"}, 253 {"type": "array", "items": {"type": "string"}} 254 ] 255 }, 256 "env_file": {"$ref": "#/definitions/string_or_list"}, 257 "environment": {"$ref": "#/definitions/list_or_dict"}, 258 259 "expose": { 260 "type": "array", 261 "items": { 262 "type": ["string", "number"], 263 "format": "expose" 264 }, 265 "uniqueItems": true 266 }, 267 268 "extends": { 269 "oneOf": [ 270 { 271 "type": "string" 272 }, 273 { 274 "type": "object", 275 276 "properties": { 277 "service": {"type": "string"}, 278 "file": {"type": "string"} 279 }, 280 "required": ["service"], 281 "additionalProperties": false 282 } 283 ] 284 }, 285 286 "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 287 "extra_hosts": {"$ref": "#/definitions/list_or_dict"}, 288 "group_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 289 "hostname": {"type": "string"}, 290 "image": {"type": "string"}, 291 "ipc": {"type": "string"}, 292 "labels": {"$ref": "#/definitions/list_or_dict"}, 293 "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 294 295 "logging": { 296 "type": "object", 297 298 "properties": { 299 "driver": {"type": "string"}, 300 "options": {"type": "object"} 301 }, 302 "additionalProperties": false 303 }, 304 305 "mac_address": {"type": "string"}, 306 "mem_limit": {"type": ["number", "string"]}, 307 "mem_reservation": {"type": ["number", "string"]}, 308 "memswap_limit": {"type": ["number", "string"]}, 309 "mem_swappiness": {"type": "integer"}, 310 "network_mode": {"type": "string"}, 311 312 "networks": { 313 "oneOf": [ 314 {"$ref": "#/definitions/list_of_strings"}, 315 { 316 "type": "object", 317 "patternProperties": { 318 "^[a-zA-Z0-9._-]+$": { 319 "oneOf": [ 320 { 321 "type": "object", 322 "properties": { 323 "aliases": {"$ref": "#/definitions/list_of_strings"}, 324 "ipv4_address": {"type": "string"}, 325 "ipv6_address": {"type": "string"} 326 }, 327 "additionalProperties": false 328 }, 329 {"type": "null"} 330 ] 331 } 332 }, 333 "additionalProperties": false 334 } 335 ] 336 }, 337 "oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000}, 338 "pid": {"type": ["string", "null"]}, 339 340 "ports": { 341 "type": "array", 342 "items": { 343 "type": ["string", "number"], 344 "format": "ports" 345 }, 346 "uniqueItems": true 347 }, 348 349 "privileged": {"type": "boolean"}, 350 "read_only": {"type": "boolean"}, 351 "restart": {"type": "string"}, 352 "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 353 "shm_size": {"type": ["number", "string"]}, 354 "stdin_open": {"type": "boolean"}, 355 "stop_grace_period": {"type": "string"}, 356 "stop_signal": {"type": "string"}, 357 "tmpfs": {"$ref": "#/definitions/string_or_list"}, 358 "tty": {"type": "boolean"}, 359 "ulimits": { 360 "type": "object", 361 "patternProperties": { 362 "^[a-z]+$": { 363 "oneOf": [ 364 {"type": "integer"}, 365 { 366 "type":"object", 367 "properties": { 368 "hard": {"type": "integer"}, 369 "soft": {"type": "integer"} 370 }, 371 "required": ["soft", "hard"], 372 "additionalProperties": false 373 } 374 ] 375 } 376 } 377 }, 378 "user": {"type": "string"}, 379 "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 380 "volume_driver": {"type": "string"}, 381 "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 382 "working_dir": {"type": "string"} 383 }, 384 385 "dependencies": { 386 "memswap_limit": ["mem_limit"] 387 }, 388 "additionalProperties": false 389 }, 390 391 "network": { 392 "id": "#/definitions/network", 393 "type": "object", 394 "properties": { 395 "driver": {"type": "string"}, 396 "driver_opts": { 397 "type": "object", 398 "patternProperties": { 399 "^.+$": {"type": ["string", "number"]} 400 } 401 }, 402 "ipam": { 403 "type": "object", 404 "properties": { 405 "driver": {"type": "string"}, 406 "config": { 407 "type": "array" 408 } 409 }, 410 "additionalProperties": false 411 }, 412 "external": { 413 "type": ["boolean", "object"], 414 "properties": { 415 "name": {"type": "string"} 416 }, 417 "additionalProperties": false 418 }, 419 "internal": {"type": "boolean"} 420 }, 421 "additionalProperties": false 422 }, 423 424 "volume": { 425 "id": "#/definitions/volume", 426 "type": ["object", "null"], 427 "properties": { 428 "driver": {"type": "string"}, 429 "driver_opts": { 430 "type": "object", 431 "patternProperties": { 432 "^.+$": {"type": ["string", "number"]} 433 } 434 }, 435 "external": { 436 "type": ["boolean", "object"], 437 "properties": { 438 "name": {"type": "string"} 439 } 440 } 441 }, 442 "additionalProperties": false 443 }, 444 445 "string_or_list": { 446 "oneOf": [ 447 {"type": "string"}, 448 {"$ref": "#/definitions/list_of_strings"} 449 ] 450 }, 451 452 "list_of_strings": { 453 "type": "array", 454 "items": {"type": "string"}, 455 "uniqueItems": true 456 }, 457 458 "list_or_dict": { 459 "oneOf": [ 460 { 461 "type": "object", 462 "patternProperties": { 463 ".+": { 464 "type": ["string", "number", "null"] 465 } 466 }, 467 "additionalProperties": false 468 }, 469 {"type": "array", "items": {"type": "string"}, "uniqueItems": true} 470 ] 471 }, 472 473 "constraints": { 474 "service": { 475 "id": "#/definitions/constraints/service", 476 "anyOf": [ 477 {"required": ["build"]}, 478 {"required": ["image"]} 479 ], 480 "properties": { 481 "build": { 482 "required": ["context"] 483 } 484 } 485 } 486 } 487 } 488 } 489 `