config_schema_v3.6.json 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "config_schema_v3.6.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. "ipc": {"type": "string"},
  146. "isolation": {"type": "string"},
  147. "labels": {"$ref": "#/definitions/list_or_dict"},
  148. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  149. "logging": {
  150. "type": "object",
  151. "properties": {
  152. "driver": {"type": "string"},
  153. "options": {
  154. "type": "object",
  155. "patternProperties": {
  156. "^.+$": {"type": ["string", "number", "null"]}
  157. }
  158. }
  159. },
  160. "additionalProperties": false
  161. },
  162. "mac_address": {"type": "string"},
  163. "network_mode": {"type": "string"},
  164. "networks": {
  165. "oneOf": [
  166. {"$ref": "#/definitions/list_of_strings"},
  167. {
  168. "type": "object",
  169. "patternProperties": {
  170. "^[a-zA-Z0-9._-]+$": {
  171. "oneOf": [
  172. {
  173. "type": "object",
  174. "properties": {
  175. "aliases": {"$ref": "#/definitions/list_of_strings"},
  176. "ipv4_address": {"type": "string"},
  177. "ipv6_address": {"type": "string"}
  178. },
  179. "additionalProperties": false
  180. },
  181. {"type": "null"}
  182. ]
  183. }
  184. },
  185. "additionalProperties": false
  186. }
  187. ]
  188. },
  189. "pid": {"type": ["string", "null"]},
  190. "ports": {
  191. "type": "array",
  192. "items": {
  193. "oneOf": [
  194. {"type": "number", "format": "ports"},
  195. {"type": "string", "format": "ports"},
  196. {
  197. "type": "object",
  198. "properties": {
  199. "mode": {"type": "string"},
  200. "target": {"type": "integer"},
  201. "published": {"type": "integer"},
  202. "protocol": {"type": "string"}
  203. },
  204. "additionalProperties": false
  205. }
  206. ]
  207. },
  208. "uniqueItems": true
  209. },
  210. "privileged": {"type": "boolean"},
  211. "read_only": {"type": "boolean"},
  212. "restart": {"type": "string"},
  213. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  214. "shm_size": {"type": ["number", "string"]},
  215. "secrets": {
  216. "type": "array",
  217. "items": {
  218. "oneOf": [
  219. {"type": "string"},
  220. {
  221. "type": "object",
  222. "properties": {
  223. "source": {"type": "string"},
  224. "target": {"type": "string"},
  225. "uid": {"type": "string"},
  226. "gid": {"type": "string"},
  227. "mode": {"type": "number"}
  228. }
  229. }
  230. ]
  231. }
  232. },
  233. "sysctls": {"$ref": "#/definitions/list_or_dict"},
  234. "stdin_open": {"type": "boolean"},
  235. "stop_grace_period": {"type": "string", "format": "duration"},
  236. "stop_signal": {"type": "string"},
  237. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  238. "tty": {"type": "boolean"},
  239. "ulimits": {
  240. "type": "object",
  241. "patternProperties": {
  242. "^[a-z]+$": {
  243. "oneOf": [
  244. {"type": "integer"},
  245. {
  246. "type":"object",
  247. "properties": {
  248. "hard": {"type": "integer"},
  249. "soft": {"type": "integer"}
  250. },
  251. "required": ["soft", "hard"],
  252. "additionalProperties": false
  253. }
  254. ]
  255. }
  256. }
  257. },
  258. "user": {"type": "string"},
  259. "userns_mode": {"type": "string"},
  260. "volumes": {
  261. "type": "array",
  262. "items": {
  263. "oneOf": [
  264. {"type": "string"},
  265. {
  266. "type": "object",
  267. "required": ["type"],
  268. "properties": {
  269. "type": {"type": "string"},
  270. "source": {"type": "string"},
  271. "target": {"type": "string"},
  272. "read_only": {"type": "boolean"},
  273. "consistency": {"type": "string"},
  274. "bind": {
  275. "type": "object",
  276. "properties": {
  277. "propagation": {"type": "string"}
  278. }
  279. },
  280. "volume": {
  281. "type": "object",
  282. "properties": {
  283. "nocopy": {"type": "boolean"}
  284. }
  285. },
  286. "tmpfs": {
  287. "type": "object",
  288. "properties": {
  289. "size": {
  290. "type": "integer",
  291. "minimum": 0
  292. }
  293. }
  294. }
  295. },
  296. "additionalProperties": false
  297. }
  298. ],
  299. "uniqueItems": true
  300. }
  301. },
  302. "working_dir": {"type": "string"}
  303. },
  304. "additionalProperties": false
  305. },
  306. "healthcheck": {
  307. "id": "#/definitions/healthcheck",
  308. "type": "object",
  309. "additionalProperties": false,
  310. "properties": {
  311. "disable": {"type": "boolean"},
  312. "interval": {"type": "string", "format": "duration"},
  313. "retries": {"type": "number"},
  314. "test": {
  315. "oneOf": [
  316. {"type": "string"},
  317. {"type": "array", "items": {"type": "string"}}
  318. ]
  319. },
  320. "timeout": {"type": "string", "format": "duration"},
  321. "start_period": {"type": "string", "format": "duration"}
  322. }
  323. },
  324. "deployment": {
  325. "id": "#/definitions/deployment",
  326. "type": ["object", "null"],
  327. "properties": {
  328. "mode": {"type": "string"},
  329. "endpoint_mode": {"type": "string"},
  330. "replicas": {"type": "integer"},
  331. "labels": {"$ref": "#/definitions/list_or_dict"},
  332. "update_config": {
  333. "type": "object",
  334. "properties": {
  335. "parallelism": {"type": "integer"},
  336. "delay": {"type": "string", "format": "duration"},
  337. "failure_action": {"type": "string"},
  338. "monitor": {"type": "string", "format": "duration"},
  339. "max_failure_ratio": {"type": "number"},
  340. "order": {"type": "string", "enum": [
  341. "start-first", "stop-first"
  342. ]}
  343. },
  344. "additionalProperties": false
  345. },
  346. "resources": {
  347. "type": "object",
  348. "properties": {
  349. "limits": {
  350. "type": "object",
  351. "properties": {
  352. "cpus": {"type": "string"},
  353. "memory": {"type": "string"}
  354. },
  355. "additionalProperties": false
  356. },
  357. "reservations": {
  358. "type": "object",
  359. "properties": {
  360. "cpus": {"type": "string"},
  361. "memory": {"type": "string"},
  362. "generic_resources": {"$ref": "#/definitions/generic_resources"}
  363. },
  364. "additionalProperties": false
  365. }
  366. },
  367. "additionalProperties": false
  368. },
  369. "restart_policy": {
  370. "type": "object",
  371. "properties": {
  372. "condition": {"type": "string"},
  373. "delay": {"type": "string", "format": "duration"},
  374. "max_attempts": {"type": "integer"},
  375. "window": {"type": "string", "format": "duration"}
  376. },
  377. "additionalProperties": false
  378. },
  379. "placement": {
  380. "type": "object",
  381. "properties": {
  382. "constraints": {"type": "array", "items": {"type": "string"}},
  383. "preferences": {
  384. "type": "array",
  385. "items": {
  386. "type": "object",
  387. "properties": {
  388. "spread": {"type": "string"}
  389. },
  390. "additionalProperties": false
  391. }
  392. }
  393. },
  394. "additionalProperties": false
  395. }
  396. },
  397. "additionalProperties": false
  398. },
  399. "generic_resources": {
  400. "id": "#/definitions/generic_resources",
  401. "type": "array",
  402. "items": {
  403. "type": "object",
  404. "properties": {
  405. "discrete_resource_spec": {
  406. "type": "object",
  407. "properties": {
  408. "kind": {"type": "string"},
  409. "value": {"type": "number"}
  410. },
  411. "additionalProperties": false
  412. }
  413. },
  414. "additionalProperties": false
  415. }
  416. },
  417. "network": {
  418. "id": "#/definitions/network",
  419. "type": ["object", "null"],
  420. "properties": {
  421. "name": {"type": "string"},
  422. "driver": {"type": "string"},
  423. "driver_opts": {
  424. "type": "object",
  425. "patternProperties": {
  426. "^.+$": {"type": ["string", "number"]}
  427. }
  428. },
  429. "ipam": {
  430. "type": "object",
  431. "properties": {
  432. "driver": {"type": "string"},
  433. "config": {
  434. "type": "array",
  435. "items": {
  436. "type": "object",
  437. "properties": {
  438. "subnet": {"type": "string"}
  439. },
  440. "additionalProperties": false
  441. }
  442. }
  443. },
  444. "additionalProperties": false
  445. },
  446. "external": {
  447. "type": ["boolean", "object"],
  448. "properties": {
  449. "name": {"type": "string"}
  450. },
  451. "additionalProperties": false
  452. },
  453. "internal": {"type": "boolean"},
  454. "attachable": {"type": "boolean"},
  455. "labels": {"$ref": "#/definitions/list_or_dict"}
  456. },
  457. "additionalProperties": false
  458. },
  459. "volume": {
  460. "id": "#/definitions/volume",
  461. "type": ["object", "null"],
  462. "properties": {
  463. "name": {"type": "string"},
  464. "driver": {"type": "string"},
  465. "driver_opts": {
  466. "type": "object",
  467. "patternProperties": {
  468. "^.+$": {"type": ["string", "number"]}
  469. }
  470. },
  471. "external": {
  472. "type": ["boolean", "object"],
  473. "properties": {
  474. "name": {"type": "string"}
  475. },
  476. "additionalProperties": false
  477. },
  478. "labels": {"$ref": "#/definitions/list_or_dict"}
  479. },
  480. "additionalProperties": false
  481. },
  482. "secret": {
  483. "id": "#/definitions/secret",
  484. "type": "object",
  485. "properties": {
  486. "name": {"type": "string"},
  487. "file": {"type": "string"},
  488. "external": {
  489. "type": ["boolean", "object"],
  490. "properties": {
  491. "name": {"type": "string"}
  492. }
  493. },
  494. "labels": {"$ref": "#/definitions/list_or_dict"}
  495. },
  496. "additionalProperties": false
  497. },
  498. "config": {
  499. "id": "#/definitions/config",
  500. "type": "object",
  501. "properties": {
  502. "name": {"type": "string"},
  503. "file": {"type": "string"},
  504. "external": {
  505. "type": ["boolean", "object"],
  506. "properties": {
  507. "name": {"type": "string"}
  508. }
  509. },
  510. "labels": {"$ref": "#/definitions/list_or_dict"}
  511. },
  512. "additionalProperties": false
  513. },
  514. "string_or_list": {
  515. "oneOf": [
  516. {"type": "string"},
  517. {"$ref": "#/definitions/list_of_strings"}
  518. ]
  519. },
  520. "list_of_strings": {
  521. "type": "array",
  522. "items": {"type": "string"},
  523. "uniqueItems": true
  524. },
  525. "list_or_dict": {
  526. "oneOf": [
  527. {
  528. "type": "object",
  529. "patternProperties": {
  530. ".+": {
  531. "type": ["string", "number", "null"]
  532. }
  533. },
  534. "additionalProperties": false
  535. },
  536. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  537. ]
  538. },
  539. "constraints": {
  540. "service": {
  541. "id": "#/definitions/constraints/service",
  542. "anyOf": [
  543. {"required": ["build"]},
  544. {"required": ["image"]}
  545. ],
  546. "properties": {
  547. "build": {
  548. "required": ["context"]
  549. }
  550. }
  551. }
  552. }
  553. }
  554. }