config_schema_v2.1.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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/labels"}
  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/labels"},
  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. "priority": {"type": "number"}
  205. },
  206. "additionalProperties": false
  207. },
  208. {"type": "null"}
  209. ]
  210. }
  211. },
  212. "additionalProperties": false
  213. }
  214. ]
  215. },
  216. "oom_kill_disable": {"type": "boolean"},
  217. "oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
  218. "group_add": {
  219. "type": "array",
  220. "items": {
  221. "type": ["string", "number"]
  222. },
  223. "uniqueItems": true
  224. },
  225. "pid": {"type": ["string", "null"]},
  226. "ports": {
  227. "type": "array",
  228. "items": {
  229. "type": ["string", "number"],
  230. "format": "ports"
  231. },
  232. "uniqueItems": true
  233. },
  234. "privileged": {"type": "boolean"},
  235. "read_only": {"type": "boolean"},
  236. "restart": {"type": "string"},
  237. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  238. "shm_size": {"type": ["number", "string"]},
  239. "sysctls": {"$ref": "#/definitions/list_or_dict"},
  240. "pids_limit": {"type": ["number", "string"]},
  241. "stdin_open": {"type": "boolean"},
  242. "stop_grace_period": {"type": "string", "format": "duration"},
  243. "stop_signal": {"type": "string"},
  244. "storage_opt": {"type": "object"},
  245. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  246. "tty": {"type": "boolean"},
  247. "ulimits": {
  248. "type": "object",
  249. "patternProperties": {
  250. "^[a-z]+$": {
  251. "oneOf": [
  252. {"type": "integer"},
  253. {
  254. "type":"object",
  255. "properties": {
  256. "hard": {"type": "integer"},
  257. "soft": {"type": "integer"}
  258. },
  259. "required": ["soft", "hard"],
  260. "additionalProperties": false
  261. }
  262. ]
  263. }
  264. }
  265. },
  266. "user": {"type": "string"},
  267. "userns_mode": {"type": "string"},
  268. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  269. "volume_driver": {"type": "string"},
  270. "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  271. "working_dir": {"type": "string"}
  272. },
  273. "dependencies": {
  274. "memswap_limit": ["mem_limit"]
  275. },
  276. "additionalProperties": false
  277. },
  278. "healthcheck": {
  279. "id": "#/definitions/healthcheck",
  280. "type": "object",
  281. "additionalProperties": false,
  282. "properties": {
  283. "disable": {"type": "boolean"},
  284. "interval": {"type": "string"},
  285. "retries": {"type": "number"},
  286. "test": {
  287. "oneOf": [
  288. {"type": "string"},
  289. {"type": "array", "items": {"type": "string"}}
  290. ]
  291. },
  292. "timeout": {"type": "string"}
  293. }
  294. },
  295. "network": {
  296. "id": "#/definitions/network",
  297. "type": "object",
  298. "properties": {
  299. "driver": {"type": "string"},
  300. "driver_opts": {
  301. "type": "object",
  302. "patternProperties": {
  303. "^.+$": {"type": ["string", "number"]}
  304. }
  305. },
  306. "ipam": {
  307. "type": "object",
  308. "properties": {
  309. "driver": {"type": "string"},
  310. "config": {
  311. "type": "array"
  312. },
  313. "options": {
  314. "type": "object",
  315. "patternProperties": {
  316. "^.+$": {"type": "string"}
  317. },
  318. "additionalProperties": false
  319. }
  320. },
  321. "additionalProperties": false
  322. },
  323. "external": {
  324. "type": ["boolean", "object"],
  325. "properties": {
  326. "name": {"type": "string"}
  327. },
  328. "additionalProperties": false
  329. },
  330. "internal": {"type": "boolean"},
  331. "enable_ipv6": {"type": "boolean"},
  332. "labels": {"$ref": "#/definitions/labels"},
  333. "name": {"type": "string"}
  334. },
  335. "additionalProperties": false
  336. },
  337. "volume": {
  338. "id": "#/definitions/volume",
  339. "type": ["object", "null"],
  340. "properties": {
  341. "driver": {"type": "string"},
  342. "driver_opts": {
  343. "type": "object",
  344. "patternProperties": {
  345. "^.+$": {"type": ["string", "number"]}
  346. }
  347. },
  348. "external": {
  349. "type": ["boolean", "object"],
  350. "properties": {
  351. "name": {"type": "string"}
  352. },
  353. "additionalProperties": false
  354. },
  355. "labels": {"$ref": "#/definitions/labels"},
  356. "name": {"type": "string"}
  357. },
  358. "additionalProperties": false
  359. },
  360. "string_or_list": {
  361. "oneOf": [
  362. {"type": "string"},
  363. {"$ref": "#/definitions/list_of_strings"}
  364. ]
  365. },
  366. "list_of_strings": {
  367. "type": "array",
  368. "items": {"type": "string"},
  369. "uniqueItems": true
  370. },
  371. "list_or_dict": {
  372. "oneOf": [
  373. {
  374. "type": "object",
  375. "patternProperties": {
  376. ".+": {
  377. "type": ["string", "number", "null"]
  378. }
  379. },
  380. "additionalProperties": false
  381. },
  382. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  383. ]
  384. },
  385. "labels": {
  386. "oneOf": [
  387. {
  388. "type": "object",
  389. "patternProperties": {
  390. ".+": {
  391. "type": "string"
  392. }
  393. },
  394. "additionalProperties": false
  395. },
  396. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  397. ]
  398. },
  399. "blkio_limit": {
  400. "type": "object",
  401. "properties": {
  402. "path": {"type": "string"},
  403. "rate": {"type": ["integer", "string"]}
  404. },
  405. "additionalProperties": false
  406. },
  407. "blkio_weight": {
  408. "type": "object",
  409. "properties": {
  410. "path": {"type": "string"},
  411. "weight": {"type": "integer"}
  412. },
  413. "additionalProperties": false
  414. },
  415. "constraints": {
  416. "service": {
  417. "id": "#/definitions/constraints/service",
  418. "anyOf": [
  419. {"required": ["build"]},
  420. {"required": ["image"]}
  421. ],
  422. "properties": {
  423. "build": {
  424. "required": ["context"]
  425. }
  426. }
  427. }
  428. }
  429. }
  430. }