config_schema_v3.1.json 12 KB

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