config_schema_v3.0.json 11 KB

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