config_schema_v2.1.json 14 KB

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