config_schema_v2.2.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "config_schema_v2.2.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. "cache_from": {"$ref": "#/definitions/list_of_strings"},
  84. "network": {"type": "string"},
  85. "isolation": {"type": "string"}
  86. },
  87. "additionalProperties": false
  88. }
  89. ]
  90. },
  91. "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  92. "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  93. "cgroup_parent": {"type": "string"},
  94. "command": {
  95. "oneOf": [
  96. {"type": "string"},
  97. {"type": "array", "items": {"type": "string"}}
  98. ]
  99. },
  100. "container_name": {"type": "string"},
  101. "cpu_count": {"type": "integer", "minimum": 0},
  102. "cpu_percent": {"type": "integer", "minimum": 0, "maximum": 100},
  103. "cpu_shares": {"type": ["number", "string"]},
  104. "cpu_quota": {"type": ["number", "string"]},
  105. "cpu_period": {"type": ["number", "string"]},
  106. "cpu_rt_period": {"type": ["number", "string"]},
  107. "cpu_rt_runtime": {"type": ["number", "string"]},
  108. "cpus": {"type": "number", "minimum": 0},
  109. "cpuset": {"type": "string"},
  110. "depends_on": {
  111. "oneOf": [
  112. {"$ref": "#/definitions/list_of_strings"},
  113. {
  114. "type": "object",
  115. "additionalProperties": false,
  116. "patternProperties": {
  117. "^[a-zA-Z0-9._-]+$": {
  118. "type": "object",
  119. "additionalProperties": false,
  120. "properties": {
  121. "condition": {
  122. "type": "string",
  123. "enum": ["service_started", "service_healthy"]
  124. }
  125. },
  126. "required": ["condition"]
  127. }
  128. }
  129. }
  130. ]
  131. },
  132. "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  133. "dns_opt": {
  134. "type": "array",
  135. "items": {
  136. "type": "string"
  137. },
  138. "uniqueItems": true
  139. },
  140. "dns": {"$ref": "#/definitions/string_or_list"},
  141. "dns_search": {"$ref": "#/definitions/string_or_list"},
  142. "domainname": {"type": "string"},
  143. "entrypoint": {
  144. "oneOf": [
  145. {"type": "string"},
  146. {"type": "array", "items": {"type": "string"}}
  147. ]
  148. },
  149. "env_file": {"$ref": "#/definitions/string_or_list"},
  150. "environment": {"$ref": "#/definitions/list_or_dict"},
  151. "expose": {
  152. "type": "array",
  153. "items": {
  154. "type": ["string", "number"],
  155. "format": "expose"
  156. },
  157. "uniqueItems": true
  158. },
  159. "extends": {
  160. "oneOf": [
  161. {
  162. "type": "string"
  163. },
  164. {
  165. "type": "object",
  166. "properties": {
  167. "service": {"type": "string"},
  168. "file": {"type": "string"}
  169. },
  170. "required": ["service"],
  171. "additionalProperties": false
  172. }
  173. ]
  174. },
  175. "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  176. "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
  177. "healthcheck": {"$ref": "#/definitions/healthcheck"},
  178. "hostname": {"type": "string"},
  179. "image": {"type": "string"},
  180. "init": {"type": ["boolean", "string"]},
  181. "ipc": {"type": "string"},
  182. "isolation": {"type": "string"},
  183. "labels": {"$ref": "#/definitions/labels"},
  184. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  185. "logging": {
  186. "type": "object",
  187. "properties": {
  188. "driver": {"type": "string"},
  189. "options": {"type": "object"}
  190. },
  191. "additionalProperties": false
  192. },
  193. "mac_address": {"type": "string"},
  194. "mem_limit": {"type": ["number", "string"]},
  195. "mem_reservation": {"type": ["string", "integer"]},
  196. "mem_swappiness": {"type": "integer"},
  197. "memswap_limit": {"type": ["number", "string"]},
  198. "network_mode": {"type": "string"},
  199. "networks": {
  200. "oneOf": [
  201. {"$ref": "#/definitions/list_of_strings"},
  202. {
  203. "type": "object",
  204. "patternProperties": {
  205. "^[a-zA-Z0-9._-]+$": {
  206. "oneOf": [
  207. {
  208. "type": "object",
  209. "properties": {
  210. "aliases": {"$ref": "#/definitions/list_of_strings"},
  211. "ipv4_address": {"type": "string"},
  212. "ipv6_address": {"type": "string"},
  213. "link_local_ips": {"$ref": "#/definitions/list_of_strings"},
  214. "priority": {"type": "number"}
  215. },
  216. "additionalProperties": false
  217. },
  218. {"type": "null"}
  219. ]
  220. }
  221. },
  222. "additionalProperties": false
  223. }
  224. ]
  225. },
  226. "oom_kill_disable": {"type": "boolean"},
  227. "oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
  228. "group_add": {
  229. "type": "array",
  230. "items": {
  231. "type": ["string", "number"]
  232. },
  233. "uniqueItems": true
  234. },
  235. "pid": {"type": ["string", "null"]},
  236. "ports": {
  237. "type": "array",
  238. "items": {
  239. "type": ["string", "number"],
  240. "format": "ports"
  241. },
  242. "uniqueItems": true
  243. },
  244. "privileged": {"type": "boolean"},
  245. "read_only": {"type": "boolean"},
  246. "restart": {"type": "string"},
  247. "scale": {"type": "integer"},
  248. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  249. "shm_size": {"type": ["number", "string"]},
  250. "sysctls": {"$ref": "#/definitions/list_or_dict"},
  251. "pids_limit": {"type": ["number", "string"]},
  252. "stdin_open": {"type": "boolean"},
  253. "stop_grace_period": {"type": "string", "format": "duration"},
  254. "stop_signal": {"type": "string"},
  255. "storage_opt": {"type": "object"},
  256. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  257. "tty": {"type": "boolean"},
  258. "ulimits": {
  259. "type": "object",
  260. "patternProperties": {
  261. "^[a-z]+$": {
  262. "oneOf": [
  263. {"type": "integer"},
  264. {
  265. "type":"object",
  266. "properties": {
  267. "hard": {"type": "integer"},
  268. "soft": {"type": "integer"}
  269. },
  270. "required": ["soft", "hard"],
  271. "additionalProperties": false
  272. }
  273. ]
  274. }
  275. }
  276. },
  277. "user": {"type": "string"},
  278. "userns_mode": {"type": "string"},
  279. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  280. "volume_driver": {"type": "string"},
  281. "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  282. "working_dir": {"type": "string"}
  283. },
  284. "dependencies": {
  285. "memswap_limit": ["mem_limit"]
  286. },
  287. "additionalProperties": false
  288. },
  289. "healthcheck": {
  290. "id": "#/definitions/healthcheck",
  291. "type": "object",
  292. "additionalProperties": false,
  293. "properties": {
  294. "disable": {"type": "boolean"},
  295. "interval": {"type": "string"},
  296. "retries": {"type": "number"},
  297. "test": {
  298. "oneOf": [
  299. {"type": "string"},
  300. {"type": "array", "items": {"type": "string"}}
  301. ]
  302. },
  303. "timeout": {"type": "string"}
  304. }
  305. },
  306. "network": {
  307. "id": "#/definitions/network",
  308. "type": "object",
  309. "properties": {
  310. "driver": {"type": "string"},
  311. "driver_opts": {
  312. "type": "object",
  313. "patternProperties": {
  314. "^.+$": {"type": ["string", "number"]}
  315. }
  316. },
  317. "ipam": {
  318. "type": "object",
  319. "properties": {
  320. "driver": {"type": "string"},
  321. "config": {
  322. "type": "array"
  323. },
  324. "options": {
  325. "type": "object",
  326. "patternProperties": {
  327. "^.+$": {"type": "string"}
  328. },
  329. "additionalProperties": false
  330. }
  331. },
  332. "additionalProperties": false
  333. },
  334. "external": {
  335. "type": ["boolean", "object"],
  336. "properties": {
  337. "name": {"type": "string"}
  338. },
  339. "additionalProperties": false
  340. },
  341. "internal": {"type": "boolean"},
  342. "enable_ipv6": {"type": "boolean"},
  343. "labels": {"$ref": "#/definitions/labels"},
  344. "name": {"type": "string"}
  345. },
  346. "additionalProperties": false
  347. },
  348. "volume": {
  349. "id": "#/definitions/volume",
  350. "type": ["object", "null"],
  351. "properties": {
  352. "driver": {"type": "string"},
  353. "driver_opts": {
  354. "type": "object",
  355. "patternProperties": {
  356. "^.+$": {"type": ["string", "number"]}
  357. }
  358. },
  359. "external": {
  360. "type": ["boolean", "object"],
  361. "properties": {
  362. "name": {"type": "string"}
  363. },
  364. "additionalProperties": false
  365. },
  366. "labels": {"$ref": "#/definitions/labels"},
  367. "name": {"type": "string"}
  368. },
  369. "additionalProperties": false
  370. },
  371. "string_or_list": {
  372. "oneOf": [
  373. {"type": "string"},
  374. {"$ref": "#/definitions/list_of_strings"}
  375. ]
  376. },
  377. "list_of_strings": {
  378. "type": "array",
  379. "items": {"type": "string"},
  380. "uniqueItems": true
  381. },
  382. "list_or_dict": {
  383. "oneOf": [
  384. {
  385. "type": "object",
  386. "patternProperties": {
  387. ".+": {
  388. "type": ["string", "number", "null"]
  389. }
  390. },
  391. "additionalProperties": false
  392. },
  393. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  394. ]
  395. },
  396. "labels": {
  397. "oneOf": [
  398. {
  399. "type": "object",
  400. "patternProperties": {
  401. ".+": {
  402. "type": "string"
  403. }
  404. },
  405. "additionalProperties": false
  406. },
  407. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  408. ]
  409. },
  410. "blkio_limit": {
  411. "type": "object",
  412. "properties": {
  413. "path": {"type": "string"},
  414. "rate": {"type": ["integer", "string"]}
  415. },
  416. "additionalProperties": false
  417. },
  418. "blkio_weight": {
  419. "type": "object",
  420. "properties": {
  421. "path": {"type": "string"},
  422. "weight": {"type": "integer"}
  423. },
  424. "additionalProperties": false
  425. },
  426. "constraints": {
  427. "service": {
  428. "id": "#/definitions/constraints/service",
  429. "anyOf": [
  430. {"required": ["build"]},
  431. {"required": ["image"]}
  432. ],
  433. "properties": {
  434. "build": {
  435. "required": ["context"]
  436. }
  437. }
  438. }
  439. }
  440. }
  441. }