config_schema_v2.2.json 12 KB

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