config_schema_v3.0.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "config_schema_v3.0.json",
  4. "type": "object",
  5. "required": ["version"],
  6. "properties": {
  7. "version": {
  8. "type": "string"
  9. },
  10. "services": {
  11. "id": "#/properties/services",
  12. "type": "object",
  13. "patternProperties": {
  14. "^[a-zA-Z0-9._-]+$": {
  15. "$ref": "#/definitions/service"
  16. }
  17. },
  18. "additionalProperties": false
  19. },
  20. "networks": {
  21. "id": "#/properties/networks",
  22. "type": "object",
  23. "patternProperties": {
  24. "^[a-zA-Z0-9._-]+$": {
  25. "$ref": "#/definitions/network"
  26. }
  27. }
  28. },
  29. "volumes": {
  30. "id": "#/properties/volumes",
  31. "type": "object",
  32. "patternProperties": {
  33. "^[a-zA-Z0-9._-]+$": {
  34. "$ref": "#/definitions/volume"
  35. }
  36. },
  37. "additionalProperties": false
  38. }
  39. },
  40. "additionalProperties": false,
  41. "definitions": {
  42. "service": {
  43. "id": "#/definitions/service",
  44. "type": "object",
  45. "properties": {
  46. "deploy": {"$ref": "#/definitions/deployment"},
  47. "build": {
  48. "oneOf": [
  49. {"type": "string"},
  50. {
  51. "type": "object",
  52. "properties": {
  53. "context": {"type": "string"},
  54. "dockerfile": {"type": "string"},
  55. "args": {"$ref": "#/definitions/list_or_dict"}
  56. },
  57. "additionalProperties": false
  58. }
  59. ]
  60. },
  61. "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  62. "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  63. "cgroup_parent": {"type": "string"},
  64. "command": {
  65. "oneOf": [
  66. {"type": "string"},
  67. {"type": "array", "items": {"type": "string"}}
  68. ]
  69. },
  70. "container_name": {"type": "string"},
  71. "depends_on": {"$ref": "#/definitions/list_of_strings"},
  72. "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  73. "dns": {"$ref": "#/definitions/string_or_list"},
  74. "dns_search": {"$ref": "#/definitions/string_or_list"},
  75. "domainname": {"type": "string"},
  76. "entrypoint": {
  77. "oneOf": [
  78. {"type": "string"},
  79. {"type": "array", "items": {"type": "string"}}
  80. ]
  81. },
  82. "env_file": {"$ref": "#/definitions/string_or_list"},
  83. "environment": {"$ref": "#/definitions/list_or_dict"},
  84. "expose": {
  85. "type": "array",
  86. "items": {
  87. "type": ["string", "number"],
  88. "format": "expose"
  89. },
  90. "uniqueItems": true
  91. },
  92. "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  93. "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
  94. "healthcheck": {"$ref": "#/definitions/healthcheck"},
  95. "hostname": {"type": "string"},
  96. "image": {"type": "string"},
  97. "ipc": {"type": "string"},
  98. "labels": {"$ref": "#/definitions/list_or_dict"},
  99. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  100. "logging": {
  101. "type": "object",
  102. "properties": {
  103. "driver": {"type": "string"},
  104. "options": {
  105. "type": "object",
  106. "patternProperties": {
  107. "^.+$": {"type": ["string", "number", "null"]}
  108. }
  109. }
  110. },
  111. "additionalProperties": false
  112. },
  113. "mac_address": {"type": "string"},
  114. "network_mode": {"type": "string"},
  115. "networks": {
  116. "oneOf": [
  117. {"$ref": "#/definitions/list_of_strings"},
  118. {
  119. "type": "object",
  120. "patternProperties": {
  121. "^[a-zA-Z0-9._-]+$": {
  122. "oneOf": [
  123. {
  124. "type": "object",
  125. "properties": {
  126. "aliases": {"$ref": "#/definitions/list_of_strings"},
  127. "ipv4_address": {"type": "string"},
  128. "ipv6_address": {"type": "string"}
  129. },
  130. "additionalProperties": false
  131. },
  132. {"type": "null"}
  133. ]
  134. }
  135. },
  136. "additionalProperties": false
  137. }
  138. ]
  139. },
  140. "pid": {"type": ["string", "null"]},
  141. "ports": {
  142. "type": "array",
  143. "items": {
  144. "type": ["string", "number"],
  145. "format": "ports"
  146. },
  147. "uniqueItems": true
  148. },
  149. "privileged": {"type": "boolean"},
  150. "read_only": {"type": "boolean"},
  151. "restart": {"type": "string"},
  152. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  153. "shm_size": {"type": ["number", "string"]},
  154. "stdin_open": {"type": "boolean"},
  155. "stop_signal": {"type": "string"},
  156. "stop_grace_period": {"type": "string", "format": "duration"},
  157. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  158. "tty": {"type": "boolean"},
  159. "ulimits": {
  160. "type": "object",
  161. "patternProperties": {
  162. "^[a-z]+$": {
  163. "oneOf": [
  164. {"type": "integer"},
  165. {
  166. "type":"object",
  167. "properties": {
  168. "hard": {"type": "integer"},
  169. "soft": {"type": "integer"}
  170. },
  171. "required": ["soft", "hard"],
  172. "additionalProperties": false
  173. }
  174. ]
  175. }
  176. }
  177. },
  178. "user": {"type": "string"},
  179. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  180. "working_dir": {"type": "string"}
  181. },
  182. "additionalProperties": false
  183. },
  184. "healthcheck": {
  185. "id": "#/definitions/healthcheck",
  186. "type": ["object", "null"],
  187. "properties": {
  188. "interval": {"type":"string"},
  189. "timeout": {"type":"string"},
  190. "retries": {"type": "number"},
  191. "test": {
  192. "oneOf": [
  193. {"type": "string"},
  194. {"type": "array", "items": {"type": "string"}}
  195. ]
  196. },
  197. "disable": {"type": "boolean"}
  198. },
  199. "additionalProperties": false
  200. },
  201. "deployment": {
  202. "id": "#/definitions/deployment",
  203. "type": ["object", "null"],
  204. "properties": {
  205. "mode": {"type": "string"},
  206. "replicas": {"type": "integer"},
  207. "labels": {"$ref": "#/definitions/list_or_dict"},
  208. "update_config": {
  209. "type": "object",
  210. "properties": {
  211. "parallelism": {"type": "integer"},
  212. "delay": {"type": "string", "format": "duration"},
  213. "failure_action": {"type": "string"},
  214. "monitor": {"type": "string", "format": "duration"},
  215. "max_failure_ratio": {"type": "number"}
  216. },
  217. "additionalProperties": false
  218. },
  219. "resources": {
  220. "type": "object",
  221. "properties": {
  222. "limits": {"$ref": "#/definitions/resource"},
  223. "reservations": {"$ref": "#/definitions/resource"}
  224. }
  225. },
  226. "restart_policy": {
  227. "type": "object",
  228. "properties": {
  229. "condition": {"type": "string"},
  230. "delay": {"type": "string", "format": "duration"},
  231. "max_attempts": {"type": "integer"},
  232. "window": {"type": "string", "format": "duration"}
  233. },
  234. "additionalProperties": false
  235. },
  236. "placement": {
  237. "type": "object",
  238. "properties": {
  239. "constraints": {"type": "array", "items": {"type": "string"}}
  240. },
  241. "additionalProperties": false
  242. }
  243. },
  244. "additionalProperties": false
  245. },
  246. "resource": {
  247. "id": "#/definitions/resource",
  248. "type": "object",
  249. "properties": {
  250. "cpus": {"type": "string"},
  251. "memory": {"type": "string"}
  252. },
  253. "additionaProperties": false
  254. },
  255. "network": {
  256. "id": "#/definitions/network",
  257. "type": ["object", "null"],
  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. "items": {
  273. "type": "object",
  274. "properties": {
  275. "subnet": {"type": "string"}
  276. },
  277. "additionalProperties": false
  278. }
  279. }
  280. },
  281. "additionalProperties": false
  282. },
  283. "external": {
  284. "type": ["boolean", "object"],
  285. "properties": {
  286. "name": {"type": "string"}
  287. },
  288. "additionalProperties": false
  289. },
  290. "labels": {"$ref": "#/definitions/list_or_dict"}
  291. },
  292. "additionalProperties": false
  293. },
  294. "volume": {
  295. "id": "#/definitions/volume",
  296. "type": ["object", "null"],
  297. "properties": {
  298. "driver": {"type": "string"},
  299. "driver_opts": {
  300. "type": "object",
  301. "patternProperties": {
  302. "^.+$": {"type": ["string", "number"]}
  303. }
  304. },
  305. "external": {
  306. "type": ["boolean", "object"],
  307. "properties": {
  308. "name": {"type": "string"}
  309. }
  310. }
  311. },
  312. "labels": {"$ref": "#/definitions/list_or_dict"},
  313. "additionalProperties": false
  314. },
  315. "string_or_list": {
  316. "oneOf": [
  317. {"type": "string"},
  318. {"$ref": "#/definitions/list_of_strings"}
  319. ]
  320. },
  321. "list_of_strings": {
  322. "type": "array",
  323. "items": {"type": "string"},
  324. "uniqueItems": true
  325. },
  326. "list_or_dict": {
  327. "oneOf": [
  328. {
  329. "type": "object",
  330. "patternProperties": {
  331. ".+": {
  332. "type": ["string", "number", "null"]
  333. }
  334. },
  335. "additionalProperties": false
  336. },
  337. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  338. ]
  339. },
  340. "constraints": {
  341. "service": {
  342. "id": "#/definitions/constraints/service",
  343. "anyOf": [
  344. {"required": ["build"]},
  345. {"required": ["image"]}
  346. ],
  347. "properties": {
  348. "build": {
  349. "required": ["context"]
  350. }
  351. }
  352. }
  353. }
  354. }
  355. }