config_schema_v2.1.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. "additionalProperties": false,
  40. "definitions": {
  41. "service": {
  42. "id": "#/definitions/service",
  43. "type": "object",
  44. "properties": {
  45. "build": {
  46. "oneOf": [
  47. {"type": "string"},
  48. {
  49. "type": "object",
  50. "properties": {
  51. "context": {"type": "string"},
  52. "dockerfile": {"type": "string"},
  53. "args": {"$ref": "#/definitions/list_or_dict"}
  54. },
  55. "additionalProperties": false
  56. }
  57. ]
  58. },
  59. "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  60. "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  61. "cgroup_parent": {"type": "string"},
  62. "command": {
  63. "oneOf": [
  64. {"type": "string"},
  65. {"type": "array", "items": {"type": "string"}}
  66. ]
  67. },
  68. "container_name": {"type": "string"},
  69. "cpu_shares": {"type": ["number", "string"]},
  70. "cpu_quota": {"type": ["number", "string"]},
  71. "cpuset": {"type": "string"},
  72. "depends_on": {
  73. "oneOf": [
  74. {"$ref": "#/definitions/list_of_strings"},
  75. {
  76. "type": "object",
  77. "additionalProperties": false,
  78. "patternProperties": {
  79. "^[a-zA-Z0-9._-]+$": {
  80. "type": "object",
  81. "additionalProperties": false,
  82. "properties": {
  83. "condition": {
  84. "type": "string",
  85. "enum": ["service_started", "service_healthy"]
  86. }
  87. },
  88. "required": ["condition"]
  89. }
  90. }
  91. }
  92. ]
  93. },
  94. "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  95. "dns_opt": {
  96. "type": "array",
  97. "items": {
  98. "type": "string"
  99. },
  100. "uniqueItems": true
  101. },
  102. "dns": {"$ref": "#/definitions/string_or_list"},
  103. "dns_search": {"$ref": "#/definitions/string_or_list"},
  104. "domainname": {"type": "string"},
  105. "entrypoint": {
  106. "oneOf": [
  107. {"type": "string"},
  108. {"type": "array", "items": {"type": "string"}}
  109. ]
  110. },
  111. "env_file": {"$ref": "#/definitions/string_or_list"},
  112. "environment": {"$ref": "#/definitions/list_or_dict"},
  113. "expose": {
  114. "type": "array",
  115. "items": {
  116. "type": ["string", "number"],
  117. "format": "expose"
  118. },
  119. "uniqueItems": true
  120. },
  121. "extends": {
  122. "oneOf": [
  123. {
  124. "type": "string"
  125. },
  126. {
  127. "type": "object",
  128. "properties": {
  129. "service": {"type": "string"},
  130. "file": {"type": "string"}
  131. },
  132. "required": ["service"],
  133. "additionalProperties": false
  134. }
  135. ]
  136. },
  137. "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  138. "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
  139. "healthcheck": {"$ref": "#/definitions/healthcheck"},
  140. "hostname": {"type": "string"},
  141. "image": {"type": "string"},
  142. "ipc": {"type": "string"},
  143. "isolation": {"type": "string"},
  144. "labels": {"$ref": "#/definitions/list_or_dict"},
  145. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  146. "logging": {
  147. "type": "object",
  148. "properties": {
  149. "driver": {"type": "string"},
  150. "options": {"type": "object"}
  151. },
  152. "additionalProperties": false
  153. },
  154. "mac_address": {"type": "string"},
  155. "mem_limit": {"type": ["number", "string"]},
  156. "mem_reservation": {"type": ["string", "integer"]},
  157. "mem_swappiness": {"type": "integer"},
  158. "memswap_limit": {"type": ["number", "string"]},
  159. "network_mode": {"type": "string"},
  160. "networks": {
  161. "oneOf": [
  162. {"$ref": "#/definitions/list_of_strings"},
  163. {
  164. "type": "object",
  165. "patternProperties": {
  166. "^[a-zA-Z0-9._-]+$": {
  167. "oneOf": [
  168. {
  169. "type": "object",
  170. "properties": {
  171. "aliases": {"$ref": "#/definitions/list_of_strings"},
  172. "ipv4_address": {"type": "string"},
  173. "ipv6_address": {"type": "string"},
  174. "link_local_ips": {"$ref": "#/definitions/list_of_strings"}
  175. },
  176. "additionalProperties": false
  177. },
  178. {"type": "null"}
  179. ]
  180. }
  181. },
  182. "additionalProperties": false
  183. }
  184. ]
  185. },
  186. "oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
  187. "group_add": {
  188. "type": "array",
  189. "items": {
  190. "type": ["string", "number"]
  191. },
  192. "uniqueItems": true
  193. },
  194. "pid": {"type": ["string", "null"]},
  195. "ports": {
  196. "type": "array",
  197. "items": {
  198. "type": ["string", "number"],
  199. "format": "ports"
  200. },
  201. "uniqueItems": true
  202. },
  203. "privileged": {"type": "boolean"},
  204. "read_only": {"type": "boolean"},
  205. "restart": {"type": "string"},
  206. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  207. "shm_size": {"type": ["number", "string"]},
  208. "sysctls": {"$ref": "#/definitions/list_or_dict"},
  209. "pids_limit": {"type": ["number", "string"]},
  210. "stdin_open": {"type": "boolean"},
  211. "stop_grace_period": {"type": "string", "format": "duration"},
  212. "stop_signal": {"type": "string"},
  213. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  214. "tty": {"type": "boolean"},
  215. "ulimits": {
  216. "type": "object",
  217. "patternProperties": {
  218. "^[a-z]+$": {
  219. "oneOf": [
  220. {"type": "integer"},
  221. {
  222. "type":"object",
  223. "properties": {
  224. "hard": {"type": "integer"},
  225. "soft": {"type": "integer"}
  226. },
  227. "required": ["soft", "hard"],
  228. "additionalProperties": false
  229. }
  230. ]
  231. }
  232. }
  233. },
  234. "user": {"type": "string"},
  235. "userns_mode": {"type": "string"},
  236. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  237. "volume_driver": {"type": "string"},
  238. "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  239. "working_dir": {"type": "string"}
  240. },
  241. "dependencies": {
  242. "memswap_limit": ["mem_limit"]
  243. },
  244. "additionalProperties": false
  245. },
  246. "healthcheck": {
  247. "id": "#/definitions/healthcheck",
  248. "type": "object",
  249. "additionalProperties": false,
  250. "properties": {
  251. "disable": {"type": "boolean"},
  252. "interval": {"type": "string"},
  253. "retries": {"type": "number"},
  254. "test": {
  255. "oneOf": [
  256. {"type": "string"},
  257. {"type": "array", "items": {"type": "string"}}
  258. ]
  259. },
  260. "timeout": {"type": "string"}
  261. }
  262. },
  263. "network": {
  264. "id": "#/definitions/network",
  265. "type": "object",
  266. "properties": {
  267. "driver": {"type": "string"},
  268. "driver_opts": {
  269. "type": "object",
  270. "patternProperties": {
  271. "^.+$": {"type": ["string", "number"]}
  272. }
  273. },
  274. "ipam": {
  275. "type": "object",
  276. "properties": {
  277. "driver": {"type": "string"},
  278. "config": {
  279. "type": "array"
  280. }
  281. },
  282. "additionalProperties": false
  283. },
  284. "external": {
  285. "type": ["boolean", "object"],
  286. "properties": {
  287. "name": {"type": "string"}
  288. },
  289. "additionalProperties": false
  290. },
  291. "internal": {"type": "boolean"},
  292. "enable_ipv6": {"type": "boolean"},
  293. "labels": {"$ref": "#/definitions/list_or_dict"}
  294. },
  295. "additionalProperties": false
  296. },
  297. "volume": {
  298. "id": "#/definitions/volume",
  299. "type": ["object", "null"],
  300. "properties": {
  301. "driver": {"type": "string"},
  302. "driver_opts": {
  303. "type": "object",
  304. "patternProperties": {
  305. "^.+$": {"type": ["string", "number"]}
  306. }
  307. },
  308. "external": {
  309. "type": ["boolean", "object"],
  310. "properties": {
  311. "name": {"type": "string"}
  312. },
  313. "additionalProperties": false
  314. },
  315. "labels": {"$ref": "#/definitions/list_or_dict"}
  316. },
  317. "additionalProperties": false
  318. },
  319. "string_or_list": {
  320. "oneOf": [
  321. {"type": "string"},
  322. {"$ref": "#/definitions/list_of_strings"}
  323. ]
  324. },
  325. "list_of_strings": {
  326. "type": "array",
  327. "items": {"type": "string"},
  328. "uniqueItems": true
  329. },
  330. "list_or_dict": {
  331. "oneOf": [
  332. {
  333. "type": "object",
  334. "patternProperties": {
  335. ".+": {
  336. "type": ["string", "number", "null"]
  337. }
  338. },
  339. "additionalProperties": false
  340. },
  341. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  342. ]
  343. },
  344. "constraints": {
  345. "service": {
  346. "id": "#/definitions/constraints/service",
  347. "anyOf": [
  348. {"required": ["build"]},
  349. {"required": ["image"]}
  350. ],
  351. "properties": {
  352. "build": {
  353. "required": ["context"]
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }