config_schema_v2.1.json 11 KB

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