config_schema_v3.0.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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_grace_period": {"type": "string", "format": "duration"},
  157. "stop_signal": {"type": "string"},
  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. "additionalProperties": false
  228. },
  229. "restart_policy": {
  230. "type": "object",
  231. "properties": {
  232. "condition": {"type": "string"},
  233. "delay": {"type": "string", "format": "duration"},
  234. "max_attempts": {"type": "integer"},
  235. "window": {"type": "string", "format": "duration"}
  236. },
  237. "additionalProperties": false
  238. },
  239. "placement": {
  240. "type": "object",
  241. "properties": {
  242. "constraints": {"type": "array", "items": {"type": "string"}}
  243. },
  244. "additionalProperties": false
  245. }
  246. },
  247. "additionalProperties": false
  248. },
  249. "resource": {
  250. "id": "#/definitions/resource",
  251. "type": "object",
  252. "properties": {
  253. "cpus": {"type": "string"},
  254. "memory": {"type": "string"}
  255. },
  256. "additionalProperties": false
  257. },
  258. "network": {
  259. "id": "#/definitions/network",
  260. "type": ["object", "null"],
  261. "properties": {
  262. "driver": {"type": "string"},
  263. "driver_opts": {
  264. "type": "object",
  265. "patternProperties": {
  266. "^.+$": {"type": ["string", "number"]}
  267. }
  268. },
  269. "ipam": {
  270. "type": "object",
  271. "properties": {
  272. "driver": {"type": "string"},
  273. "config": {
  274. "type": "array",
  275. "items": {
  276. "type": "object",
  277. "properties": {
  278. "subnet": {"type": "string", "format": "subnet_ip_address"}
  279. },
  280. "additionalProperties": false
  281. }
  282. }
  283. },
  284. "additionalProperties": false
  285. },
  286. "external": {
  287. "type": ["boolean", "object"],
  288. "properties": {
  289. "name": {"type": "string"}
  290. },
  291. "additionalProperties": false
  292. },
  293. "internal": {"type": "boolean"},
  294. "labels": {"$ref": "#/definitions/list_or_dict"}
  295. },
  296. "additionalProperties": false
  297. },
  298. "volume": {
  299. "id": "#/definitions/volume",
  300. "type": ["object", "null"],
  301. "properties": {
  302. "driver": {"type": "string"},
  303. "driver_opts": {
  304. "type": "object",
  305. "patternProperties": {
  306. "^.+$": {"type": ["string", "number"]}
  307. }
  308. },
  309. "external": {
  310. "type": ["boolean", "object"],
  311. "properties": {
  312. "name": {"type": "string"}
  313. },
  314. "additionalProperties": false
  315. },
  316. "labels": {"$ref": "#/definitions/list_or_dict"}
  317. },
  318. "additionalProperties": false
  319. },
  320. "string_or_list": {
  321. "oneOf": [
  322. {"type": "string"},
  323. {"$ref": "#/definitions/list_of_strings"}
  324. ]
  325. },
  326. "list_of_strings": {
  327. "type": "array",
  328. "items": {"type": "string"},
  329. "uniqueItems": true
  330. },
  331. "list_or_dict": {
  332. "oneOf": [
  333. {
  334. "type": "object",
  335. "patternProperties": {
  336. ".+": {
  337. "type": ["string", "number", "null"]
  338. }
  339. },
  340. "additionalProperties": false
  341. },
  342. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  343. ]
  344. },
  345. "constraints": {
  346. "service": {
  347. "id": "#/definitions/constraints/service",
  348. "anyOf": [
  349. {"required": ["build"]},
  350. {"required": ["image"]}
  351. ],
  352. "properties": {
  353. "build": {
  354. "required": ["context"]
  355. }
  356. }
  357. }
  358. }
  359. }
  360. }