config_schema_v3.2.json 13 KB

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