config_schema_v2.1.json 11 KB

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