config_schema_v3.7.json 17 KB

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