config_schema_v3.2.json 13 KB

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