config_schema_v2.1.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "config_schema_v2.1.json",
  4. "type": "object",
  5. "properties": {
  6. "version": {
  7. "type": "string"
  8. },
  9. "services": {
  10. "id": "#/properties/services",
  11. "type": "object",
  12. "patternProperties": {
  13. "^[a-zA-Z0-9._-]+$": {
  14. "$ref": "#/definitions/service"
  15. }
  16. },
  17. "additionalProperties": false
  18. },
  19. "networks": {
  20. "id": "#/properties/networks",
  21. "type": "object",
  22. "patternProperties": {
  23. "^[a-zA-Z0-9._-]+$": {
  24. "$ref": "#/definitions/network"
  25. }
  26. }
  27. },
  28. "volumes": {
  29. "id": "#/properties/volumes",
  30. "type": "object",
  31. "patternProperties": {
  32. "^[a-zA-Z0-9._-]+$": {
  33. "$ref": "#/definitions/volume"
  34. }
  35. },
  36. "additionalProperties": false
  37. }
  38. },
  39. "patternProperties": {"^x-": {}},
  40. "additionalProperties": false,
  41. "definitions": {
  42. "service": {
  43. "id": "#/definitions/service",
  44. "type": "object",
  45. "properties": {
  46. "blkio_config": {
  47. "type": "object",
  48. "properties": {
  49. "device_read_bps": {
  50. "type": "array",
  51. "items": {"$ref": "#/definitions/blkio_limit"}
  52. },
  53. "device_read_iops": {
  54. "type": "array",
  55. "items": {"$ref": "#/definitions/blkio_limit"}
  56. },
  57. "device_write_bps": {
  58. "type": "array",
  59. "items": {"$ref": "#/definitions/blkio_limit"}
  60. },
  61. "device_write_iops": {
  62. "type": "array",
  63. "items": {"$ref": "#/definitions/blkio_limit"}
  64. },
  65. "weight": {"type": "integer"},
  66. "weight_device": {
  67. "type": "array",
  68. "items": {"$ref": "#/definitions/blkio_weight"}
  69. }
  70. },
  71. "additionalProperties": false
  72. },
  73. "build": {
  74. "oneOf": [
  75. {"type": "string"},
  76. {
  77. "type": "object",
  78. "properties": {
  79. "context": {"type": "string"},
  80. "dockerfile": {"type": "string"},
  81. "args": {"$ref": "#/definitions/list_or_dict"},
  82. "labels": {"$ref": "#/definitions/list_or_dict"}
  83. },
  84. "additionalProperties": false
  85. }
  86. ]
  87. },
  88. "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  89. "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  90. "cgroup_parent": {"type": "string"},
  91. "command": {
  92. "oneOf": [
  93. {"type": "string"},
  94. {"type": "array", "items": {"type": "string"}}
  95. ]
  96. },
  97. "container_name": {"type": "string"},
  98. "cpu_shares": {"type": ["number", "string"]},
  99. "cpu_quota": {"type": ["number", "string"]},
  100. "cpuset": {"type": "string"},
  101. "depends_on": {
  102. "oneOf": [
  103. {"$ref": "#/definitions/list_of_strings"},
  104. {
  105. "type": "object",
  106. "additionalProperties": false,
  107. "patternProperties": {
  108. "^[a-zA-Z0-9._-]+$": {
  109. "type": "object",
  110. "additionalProperties": false,
  111. "properties": {
  112. "condition": {
  113. "type": "string",
  114. "enum": ["service_started", "service_healthy"]
  115. }
  116. },
  117. "required": ["condition"]
  118. }
  119. }
  120. }
  121. ]
  122. },
  123. "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  124. "dns_opt": {
  125. "type": "array",
  126. "items": {
  127. "type": "string"
  128. },
  129. "uniqueItems": true
  130. },
  131. "dns": {"$ref": "#/definitions/string_or_list"},
  132. "dns_search": {"$ref": "#/definitions/string_or_list"},
  133. "domainname": {"type": "string"},
  134. "entrypoint": {
  135. "oneOf": [
  136. {"type": "string"},
  137. {"type": "array", "items": {"type": "string"}}
  138. ]
  139. },
  140. "env_file": {"$ref": "#/definitions/string_or_list"},
  141. "environment": {"$ref": "#/definitions/list_or_dict"},
  142. "expose": {
  143. "type": "array",
  144. "items": {
  145. "type": ["string", "number"],
  146. "format": "expose"
  147. },
  148. "uniqueItems": true
  149. },
  150. "extends": {
  151. "oneOf": [
  152. {
  153. "type": "string"
  154. },
  155. {
  156. "type": "object",
  157. "properties": {
  158. "service": {"type": "string"},
  159. "file": {"type": "string"}
  160. },
  161. "required": ["service"],
  162. "additionalProperties": false
  163. }
  164. ]
  165. },
  166. "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  167. "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
  168. "healthcheck": {"$ref": "#/definitions/healthcheck"},
  169. "hostname": {"type": "string"},
  170. "image": {"type": "string"},
  171. "ipc": {"type": "string"},
  172. "isolation": {"type": "string"},
  173. "labels": {"$ref": "#/definitions/list_or_dict"},
  174. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  175. "logging": {
  176. "type": "object",
  177. "properties": {
  178. "driver": {"type": "string"},
  179. "options": {"type": "object"}
  180. },
  181. "additionalProperties": false
  182. },
  183. "mac_address": {"type": "string"},
  184. "mem_limit": {"type": ["number", "string"]},
  185. "mem_reservation": {"type": ["string", "integer"]},
  186. "mem_swappiness": {"type": "integer"},
  187. "memswap_limit": {"type": ["number", "string"]},
  188. "network_mode": {"type": "string"},
  189. "networks": {
  190. "oneOf": [
  191. {"$ref": "#/definitions/list_of_strings"},
  192. {
  193. "type": "object",
  194. "patternProperties": {
  195. "^[a-zA-Z0-9._-]+$": {
  196. "oneOf": [
  197. {
  198. "type": "object",
  199. "properties": {
  200. "aliases": {"$ref": "#/definitions/list_of_strings"},
  201. "ipv4_address": {"type": "string"},
  202. "ipv6_address": {"type": "string"},
  203. "link_local_ips": {"$ref": "#/definitions/list_of_strings"}
  204. },
  205. "additionalProperties": false
  206. },
  207. {"type": "null"}
  208. ]
  209. }
  210. },
  211. "additionalProperties": false
  212. }
  213. ]
  214. },
  215. "oom_kill_disable": {"type": "boolean"},
  216. "oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
  217. "group_add": {
  218. "type": "array",
  219. "items": {
  220. "type": ["string", "number"]
  221. },
  222. "uniqueItems": true
  223. },
  224. "pid": {"type": ["string", "null"]},
  225. "ports": {
  226. "type": "array",
  227. "items": {
  228. "type": ["string", "number"],
  229. "format": "ports"
  230. },
  231. "uniqueItems": true
  232. },
  233. "privileged": {"type": "boolean"},
  234. "read_only": {"type": "boolean"},
  235. "restart": {"type": "string"},
  236. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  237. "shm_size": {"type": ["number", "string"]},
  238. "sysctls": {"$ref": "#/definitions/list_or_dict"},
  239. "pids_limit": {"type": ["number", "string"]},
  240. "stdin_open": {"type": "boolean"},
  241. "stop_grace_period": {"type": "string", "format": "duration"},
  242. "stop_signal": {"type": "string"},
  243. "storage_opt": {"type": "object"},
  244. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  245. "tty": {"type": "boolean"},
  246. "ulimits": {
  247. "type": "object",
  248. "patternProperties": {
  249. "^[a-z]+$": {
  250. "oneOf": [
  251. {"type": "integer"},
  252. {
  253. "type":"object",
  254. "properties": {
  255. "hard": {"type": "integer"},
  256. "soft": {"type": "integer"}
  257. },
  258. "required": ["soft", "hard"],
  259. "additionalProperties": false
  260. }
  261. ]
  262. }
  263. }
  264. },
  265. "user": {"type": "string"},
  266. "userns_mode": {"type": "string"},
  267. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  268. "volume_driver": {"type": "string"},
  269. "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  270. "working_dir": {"type": "string"}
  271. },
  272. "dependencies": {
  273. "memswap_limit": ["mem_limit"]
  274. },
  275. "additionalProperties": false
  276. },
  277. "healthcheck": {
  278. "id": "#/definitions/healthcheck",
  279. "type": "object",
  280. "additionalProperties": false,
  281. "properties": {
  282. "disable": {"type": "boolean"},
  283. "interval": {"type": "string"},
  284. "retries": {"type": "number"},
  285. "test": {
  286. "oneOf": [
  287. {"type": "string"},
  288. {"type": "array", "items": {"type": "string"}}
  289. ]
  290. },
  291. "timeout": {"type": "string"}
  292. }
  293. },
  294. "network": {
  295. "id": "#/definitions/network",
  296. "type": "object",
  297. "properties": {
  298. "driver": {"type": "string"},
  299. "driver_opts": {
  300. "type": "object",
  301. "patternProperties": {
  302. "^.+$": {"type": ["string", "number"]}
  303. }
  304. },
  305. "ipam": {
  306. "type": "object",
  307. "properties": {
  308. "driver": {"type": "string"},
  309. "config": {
  310. "type": "array"
  311. },
  312. "options": {
  313. "type": "object",
  314. "patternProperties": {
  315. "^.+$": {"type": "string"}
  316. },
  317. "additionalProperties": false
  318. }
  319. },
  320. "additionalProperties": false
  321. },
  322. "external": {
  323. "type": ["boolean", "object"],
  324. "properties": {
  325. "name": {"type": "string"}
  326. },
  327. "additionalProperties": false
  328. },
  329. "internal": {"type": "boolean"},
  330. "enable_ipv6": {"type": "boolean"},
  331. "labels": {"$ref": "#/definitions/list_or_dict"}
  332. },
  333. "additionalProperties": false
  334. },
  335. "volume": {
  336. "id": "#/definitions/volume",
  337. "type": ["object", "null"],
  338. "properties": {
  339. "driver": {"type": "string"},
  340. "driver_opts": {
  341. "type": "object",
  342. "patternProperties": {
  343. "^.+$": {"type": ["string", "number"]}
  344. }
  345. },
  346. "external": {
  347. "type": ["boolean", "object"],
  348. "properties": {
  349. "name": {"type": "string"}
  350. },
  351. "additionalProperties": false
  352. },
  353. "labels": {"$ref": "#/definitions/list_or_dict"},
  354. "name": {"type": "string"}
  355. },
  356. "additionalProperties": false
  357. },
  358. "string_or_list": {
  359. "oneOf": [
  360. {"type": "string"},
  361. {"$ref": "#/definitions/list_of_strings"}
  362. ]
  363. },
  364. "list_of_strings": {
  365. "type": "array",
  366. "items": {"type": "string"},
  367. "uniqueItems": true
  368. },
  369. "list_or_dict": {
  370. "oneOf": [
  371. {
  372. "type": "object",
  373. "patternProperties": {
  374. ".+": {
  375. "type": ["string", "number", "null"]
  376. }
  377. },
  378. "additionalProperties": false
  379. },
  380. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  381. ]
  382. },
  383. "blkio_limit": {
  384. "type": "object",
  385. "properties": {
  386. "path": {"type": "string"},
  387. "rate": {"type": ["integer", "string"]}
  388. },
  389. "additionalProperties": false
  390. },
  391. "blkio_weight": {
  392. "type": "object",
  393. "properties": {
  394. "path": {"type": "string"},
  395. "weight": {"type": "integer"}
  396. },
  397. "additionalProperties": false
  398. },
  399. "constraints": {
  400. "service": {
  401. "id": "#/definitions/constraints/service",
  402. "anyOf": [
  403. {"required": ["build"]},
  404. {"required": ["image"]}
  405. ],
  406. "properties": {
  407. "build": {
  408. "required": ["context"]
  409. }
  410. }
  411. }
  412. }
  413. }
  414. }