config_schema_v3.0.json 11 KB

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