config_schema_v2.0.json 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "config_schema_v2.0.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": {"$ref": "#/definitions/list_of_strings"},
  73. "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  74. "dns": {"$ref": "#/definitions/string_or_list"},
  75. "dns_search": {"$ref": "#/definitions/string_or_list"},
  76. "domainname": {"type": "string"},
  77. "entrypoint": {
  78. "oneOf": [
  79. {"type": "string"},
  80. {"type": "array", "items": {"type": "string"}}
  81. ]
  82. },
  83. "env_file": {"$ref": "#/definitions/string_or_list"},
  84. "environment": {"$ref": "#/definitions/list_or_dict"},
  85. "expose": {
  86. "type": "array",
  87. "items": {
  88. "type": ["string", "number"],
  89. "format": "expose"
  90. },
  91. "uniqueItems": true
  92. },
  93. "extends": {
  94. "oneOf": [
  95. {
  96. "type": "string"
  97. },
  98. {
  99. "type": "object",
  100. "properties": {
  101. "service": {"type": "string"},
  102. "file": {"type": "string"}
  103. },
  104. "required": ["service"],
  105. "additionalProperties": false
  106. }
  107. ]
  108. },
  109. "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  110. "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
  111. "hostname": {"type": "string"},
  112. "image": {"type": "string"},
  113. "ipc": {"type": "string"},
  114. "labels": {"$ref": "#/definitions/list_or_dict"},
  115. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  116. "logging": {
  117. "type": "object",
  118. "properties": {
  119. "driver": {"type": "string"},
  120. "options": {"type": "object"}
  121. },
  122. "additionalProperties": false
  123. },
  124. "mac_address": {"type": "string"},
  125. "mem_limit": {"type": ["number", "string"]},
  126. "mem_reservation": {"type": ["string", "integer"]},
  127. "mem_swappiness": {"type": "integer"},
  128. "memswap_limit": {"type": ["number", "string"]},
  129. "network_mode": {"type": "string"},
  130. "networks": {
  131. "oneOf": [
  132. {"$ref": "#/definitions/list_of_strings"},
  133. {
  134. "type": "object",
  135. "patternProperties": {
  136. "^[a-zA-Z0-9._-]+$": {
  137. "oneOf": [
  138. {
  139. "type": "object",
  140. "properties": {
  141. "aliases": {"$ref": "#/definitions/list_of_strings"},
  142. "ipv4_address": {"type": "string"},
  143. "ipv6_address": {"type": "string"}
  144. },
  145. "additionalProperties": false
  146. },
  147. {"type": "null"}
  148. ]
  149. }
  150. },
  151. "additionalProperties": false
  152. }
  153. ]
  154. },
  155. "oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
  156. "group_add": {
  157. "type": "array",
  158. "items": {
  159. "type": ["string", "number"]
  160. },
  161. "uniqueItems": true
  162. },
  163. "pid": {"type": ["string", "null"]},
  164. "ports": {
  165. "type": "array",
  166. "items": {
  167. "type": ["string", "number"],
  168. "format": "ports"
  169. },
  170. "uniqueItems": true
  171. },
  172. "privileged": {"type": "boolean"},
  173. "read_only": {"type": "boolean"},
  174. "restart": {"type": "string"},
  175. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  176. "shm_size": {"type": ["number", "string"]},
  177. "stdin_open": {"type": "boolean"},
  178. "stop_grace_period": {"type": "string", "format": "duration"},
  179. "stop_signal": {"type": "string"},
  180. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  181. "tty": {"type": "boolean"},
  182. "ulimits": {
  183. "type": "object",
  184. "patternProperties": {
  185. "^[a-z]+$": {
  186. "oneOf": [
  187. {"type": "integer"},
  188. {
  189. "type":"object",
  190. "properties": {
  191. "hard": {"type": "integer"},
  192. "soft": {"type": "integer"}
  193. },
  194. "required": ["soft", "hard"],
  195. "additionalProperties": false
  196. }
  197. ]
  198. }
  199. }
  200. },
  201. "user": {"type": "string"},
  202. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  203. "volume_driver": {"type": "string"},
  204. "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  205. "working_dir": {"type": "string"}
  206. },
  207. "dependencies": {
  208. "memswap_limit": ["mem_limit"]
  209. },
  210. "additionalProperties": false
  211. },
  212. "network": {
  213. "id": "#/definitions/network",
  214. "type": "object",
  215. "properties": {
  216. "driver": {"type": "string"},
  217. "driver_opts": {
  218. "type": "object",
  219. "patternProperties": {
  220. "^.+$": {"type": ["string", "number"]}
  221. }
  222. },
  223. "ipam": {
  224. "type": "object",
  225. "properties": {
  226. "driver": {"type": "string"},
  227. "config": {
  228. "type": "array"
  229. }
  230. },
  231. "additionalProperties": false
  232. },
  233. "external": {
  234. "type": ["boolean", "object"],
  235. "properties": {
  236. "name": {"type": "string"}
  237. },
  238. "additionalProperties": false
  239. },
  240. "internal": {"type": "boolean"}
  241. },
  242. "additionalProperties": false
  243. },
  244. "volume": {
  245. "id": "#/definitions/volume",
  246. "type": ["object", "null"],
  247. "properties": {
  248. "driver": {"type": "string"},
  249. "driver_opts": {
  250. "type": "object",
  251. "patternProperties": {
  252. "^.+$": {"type": ["string", "number"]}
  253. }
  254. },
  255. "external": {
  256. "type": ["boolean", "object"],
  257. "properties": {
  258. "name": {"type": "string"}
  259. },
  260. "additionalProperties": false
  261. }
  262. },
  263. "additionalProperties": false
  264. },
  265. "string_or_list": {
  266. "oneOf": [
  267. {"type": "string"},
  268. {"$ref": "#/definitions/list_of_strings"}
  269. ]
  270. },
  271. "list_of_strings": {
  272. "type": "array",
  273. "items": {"type": "string"},
  274. "uniqueItems": true
  275. },
  276. "list_or_dict": {
  277. "oneOf": [
  278. {
  279. "type": "object",
  280. "patternProperties": {
  281. ".+": {
  282. "type": ["string", "number", "null"]
  283. }
  284. },
  285. "additionalProperties": false
  286. },
  287. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  288. ]
  289. },
  290. "constraints": {
  291. "service": {
  292. "id": "#/definitions/constraints/service",
  293. "anyOf": [
  294. {"required": ["build"]},
  295. {"required": ["image"]}
  296. ],
  297. "properties": {
  298. "build": {
  299. "required": ["context"]
  300. }
  301. }
  302. }
  303. }
  304. }
  305. }