config_schema_v3.2.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  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": "number", "format": "ports"},
  157. {"type": "string", "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. "consistency": {"type": "string"},
  236. "bind": {
  237. "type": "object",
  238. "properties": {
  239. "propagation": {"type": "string"}
  240. }
  241. },
  242. "volume": {
  243. "type": "object",
  244. "properties": {
  245. "nocopy": {"type": "boolean"}
  246. }
  247. }
  248. }
  249. }
  250. ],
  251. "uniqueItems": true
  252. }
  253. },
  254. "working_dir": {"type": "string"}
  255. },
  256. "additionalProperties": false
  257. },
  258. "healthcheck": {
  259. "id": "#/definitions/healthcheck",
  260. "type": "object",
  261. "additionalProperties": false,
  262. "properties": {
  263. "disable": {"type": "boolean"},
  264. "interval": {"type": "string"},
  265. "retries": {"type": "number"},
  266. "test": {
  267. "oneOf": [
  268. {"type": "string"},
  269. {"type": "array", "items": {"type": "string"}}
  270. ]
  271. },
  272. "timeout": {"type": "string"}
  273. }
  274. },
  275. "deployment": {
  276. "id": "#/definitions/deployment",
  277. "type": ["object", "null"],
  278. "properties": {
  279. "mode": {"type": "string"},
  280. "endpoint_mode": {"type": "string"},
  281. "replicas": {"type": "integer"},
  282. "labels": {"$ref": "#/definitions/list_or_dict"},
  283. "update_config": {
  284. "type": "object",
  285. "properties": {
  286. "parallelism": {"type": "integer"},
  287. "delay": {"type": "string", "format": "duration"},
  288. "failure_action": {"type": "string"},
  289. "monitor": {"type": "string", "format": "duration"},
  290. "max_failure_ratio": {"type": "number"}
  291. },
  292. "additionalProperties": false
  293. },
  294. "resources": {
  295. "type": "object",
  296. "properties": {
  297. "limits": {"$ref": "#/definitions/resource"},
  298. "reservations": {"$ref": "#/definitions/resource"}
  299. },
  300. "additionalProperties": false
  301. },
  302. "restart_policy": {
  303. "type": "object",
  304. "properties": {
  305. "condition": {"type": "string"},
  306. "delay": {"type": "string", "format": "duration"},
  307. "max_attempts": {"type": "integer"},
  308. "window": {"type": "string", "format": "duration"}
  309. },
  310. "additionalProperties": false
  311. },
  312. "placement": {
  313. "type": "object",
  314. "properties": {
  315. "constraints": {"type": "array", "items": {"type": "string"}}
  316. },
  317. "additionalProperties": false
  318. }
  319. },
  320. "additionalProperties": false
  321. },
  322. "resource": {
  323. "id": "#/definitions/resource",
  324. "type": "object",
  325. "properties": {
  326. "cpus": {"type": "string"},
  327. "memory": {"type": "string"}
  328. },
  329. "additionalProperties": false
  330. },
  331. "network": {
  332. "id": "#/definitions/network",
  333. "type": ["object", "null"],
  334. "properties": {
  335. "driver": {"type": "string"},
  336. "driver_opts": {
  337. "type": "object",
  338. "patternProperties": {
  339. "^.+$": {"type": ["string", "number"]}
  340. }
  341. },
  342. "ipam": {
  343. "type": "object",
  344. "properties": {
  345. "driver": {"type": "string"},
  346. "config": {
  347. "type": "array",
  348. "items": {
  349. "type": "object",
  350. "properties": {
  351. "subnet": {"type": "string"}
  352. },
  353. "additionalProperties": false
  354. }
  355. }
  356. },
  357. "additionalProperties": false
  358. },
  359. "external": {
  360. "type": ["boolean", "object"],
  361. "properties": {
  362. "name": {"type": "string"}
  363. },
  364. "additionalProperties": false
  365. },
  366. "internal": {"type": "boolean"},
  367. "attachable": {"type": "boolean"},
  368. "labels": {"$ref": "#/definitions/list_or_dict"}
  369. },
  370. "additionalProperties": false
  371. },
  372. "volume": {
  373. "id": "#/definitions/volume",
  374. "type": ["object", "null"],
  375. "properties": {
  376. "driver": {"type": "string"},
  377. "driver_opts": {
  378. "type": "object",
  379. "patternProperties": {
  380. "^.+$": {"type": ["string", "number"]}
  381. }
  382. },
  383. "external": {
  384. "type": ["boolean", "object"],
  385. "properties": {
  386. "name": {"type": "string"}
  387. },
  388. "additionalProperties": false
  389. },
  390. "labels": {"$ref": "#/definitions/list_or_dict"}
  391. },
  392. "additionalProperties": false
  393. },
  394. "secret": {
  395. "id": "#/definitions/secret",
  396. "type": "object",
  397. "properties": {
  398. "file": {"type": "string"},
  399. "external": {
  400. "type": ["boolean", "object"],
  401. "properties": {
  402. "name": {"type": "string"}
  403. }
  404. },
  405. "labels": {"$ref": "#/definitions/list_or_dict"}
  406. },
  407. "additionalProperties": false
  408. },
  409. "string_or_list": {
  410. "oneOf": [
  411. {"type": "string"},
  412. {"$ref": "#/definitions/list_of_strings"}
  413. ]
  414. },
  415. "list_of_strings": {
  416. "type": "array",
  417. "items": {"type": "string"},
  418. "uniqueItems": true
  419. },
  420. "list_or_dict": {
  421. "oneOf": [
  422. {
  423. "type": "object",
  424. "patternProperties": {
  425. ".+": {
  426. "type": ["string", "number", "null"]
  427. }
  428. },
  429. "additionalProperties": false
  430. },
  431. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  432. ]
  433. },
  434. "constraints": {
  435. "service": {
  436. "id": "#/definitions/constraints/service",
  437. "anyOf": [
  438. {"required": ["build"]},
  439. {"required": ["image"]}
  440. ],
  441. "properties": {
  442. "build": {
  443. "required": ["context"]
  444. }
  445. }
  446. }
  447. }
  448. }
  449. }