config_schema_v2.2.json 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  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. "items": {"$ref": "#/definitions/ipam_config"}
  324. },
  325. "options": {
  326. "type": "object",
  327. "patternProperties": {
  328. "^.+$": {"type": "string"}
  329. },
  330. "additionalProperties": false
  331. }
  332. },
  333. "additionalProperties": false
  334. },
  335. "external": {
  336. "type": ["boolean", "object"],
  337. "properties": {
  338. "name": {"type": "string"}
  339. },
  340. "additionalProperties": false
  341. },
  342. "internal": {"type": "boolean"},
  343. "enable_ipv6": {"type": "boolean"},
  344. "labels": {"$ref": "#/definitions/labels"},
  345. "name": {"type": "string"}
  346. },
  347. "additionalProperties": false
  348. },
  349. "ipam_config": {
  350. "id": "#/definitions/ipam_config",
  351. "type": "object",
  352. "properties": {
  353. "subnet": {"type": "string"},
  354. "ip_range": {"type": "string"},
  355. "gateway": {"type": "string"},
  356. "aux_addresses": {
  357. "type": "object",
  358. "patternProperties": {
  359. "^.+$": {"type": "string"}
  360. },
  361. "additionalProperties": false
  362. }
  363. },
  364. "additionalProperties": false
  365. },
  366. "volume": {
  367. "id": "#/definitions/volume",
  368. "type": ["object", "null"],
  369. "properties": {
  370. "driver": {"type": "string"},
  371. "driver_opts": {
  372. "type": "object",
  373. "patternProperties": {
  374. "^.+$": {"type": ["string", "number"]}
  375. }
  376. },
  377. "external": {
  378. "type": ["boolean", "object"],
  379. "properties": {
  380. "name": {"type": "string"}
  381. },
  382. "additionalProperties": false
  383. },
  384. "labels": {"$ref": "#/definitions/labels"},
  385. "name": {"type": "string"}
  386. },
  387. "additionalProperties": false
  388. },
  389. "string_or_list": {
  390. "oneOf": [
  391. {"type": "string"},
  392. {"$ref": "#/definitions/list_of_strings"}
  393. ]
  394. },
  395. "list_of_strings": {
  396. "type": "array",
  397. "items": {"type": "string"},
  398. "uniqueItems": true
  399. },
  400. "list_or_dict": {
  401. "oneOf": [
  402. {
  403. "type": "object",
  404. "patternProperties": {
  405. ".+": {
  406. "type": ["string", "number", "null"]
  407. }
  408. },
  409. "additionalProperties": false
  410. },
  411. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  412. ]
  413. },
  414. "labels": {
  415. "oneOf": [
  416. {
  417. "type": "object",
  418. "patternProperties": {
  419. ".+": {
  420. "type": "string"
  421. }
  422. },
  423. "additionalProperties": false
  424. },
  425. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  426. ]
  427. },
  428. "blkio_limit": {
  429. "type": "object",
  430. "properties": {
  431. "path": {"type": "string"},
  432. "rate": {"type": ["integer", "string"]}
  433. },
  434. "additionalProperties": false
  435. },
  436. "blkio_weight": {
  437. "type": "object",
  438. "properties": {
  439. "path": {"type": "string"},
  440. "weight": {"type": "integer"}
  441. },
  442. "additionalProperties": false
  443. },
  444. "constraints": {
  445. "service": {
  446. "id": "#/definitions/constraints/service",
  447. "anyOf": [
  448. {"required": ["build"]},
  449. {"required": ["image"]}
  450. ],
  451. "properties": {
  452. "build": {
  453. "required": ["context"]
  454. }
  455. }
  456. }
  457. }
  458. }
  459. }