config_schema_v2.1.json 11 KB

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