config_schema_v3.2.json 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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/labels"},
  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": "number", "format": "ports"},
  158. {"type": "string", "format": "ports"},
  159. {
  160. "type": "object",
  161. "properties": {
  162. "mode": {"type": "string"},
  163. "target": {"type": "integer"},
  164. "published": {"type": "integer"},
  165. "protocol": {"type": "string"}
  166. },
  167. "additionalProperties": false
  168. }
  169. ]
  170. },
  171. "uniqueItems": true
  172. },
  173. "privileged": {"type": "boolean"},
  174. "read_only": {"type": "boolean"},
  175. "restart": {"type": "string"},
  176. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  177. "shm_size": {"type": ["number", "string"]},
  178. "secrets": {
  179. "type": "array",
  180. "items": {
  181. "oneOf": [
  182. {"type": "string"},
  183. {
  184. "type": "object",
  185. "properties": {
  186. "source": {"type": "string"},
  187. "target": {"type": "string"},
  188. "uid": {"type": "string"},
  189. "gid": {"type": "string"},
  190. "mode": {"type": "number"}
  191. }
  192. }
  193. ]
  194. }
  195. },
  196. "sysctls": {"$ref": "#/definitions/list_or_dict"},
  197. "stdin_open": {"type": "boolean"},
  198. "stop_grace_period": {"type": "string", "format": "duration"},
  199. "stop_signal": {"type": "string"},
  200. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  201. "tty": {"type": "boolean"},
  202. "ulimits": {
  203. "type": "object",
  204. "patternProperties": {
  205. "^[a-z]+$": {
  206. "oneOf": [
  207. {"type": "integer"},
  208. {
  209. "type":"object",
  210. "properties": {
  211. "hard": {"type": "integer"},
  212. "soft": {"type": "integer"}
  213. },
  214. "required": ["soft", "hard"],
  215. "additionalProperties": false
  216. }
  217. ]
  218. }
  219. }
  220. },
  221. "user": {"type": "string"},
  222. "userns_mode": {"type": "string"},
  223. "volumes": {
  224. "type": "array",
  225. "items": {
  226. "oneOf": [
  227. {"type": "string"},
  228. {
  229. "type": "object",
  230. "required": ["type"],
  231. "additionalProperties": false,
  232. "properties": {
  233. "type": {"type": "string"},
  234. "source": {"type": "string"},
  235. "target": {"type": "string"},
  236. "read_only": {"type": "boolean"},
  237. "consistency": {"type": "string"},
  238. "bind": {
  239. "type": "object",
  240. "properties": {
  241. "propagation": {"type": "string"}
  242. }
  243. },
  244. "volume": {
  245. "type": "object",
  246. "properties": {
  247. "nocopy": {"type": "boolean"}
  248. }
  249. }
  250. }
  251. }
  252. ],
  253. "uniqueItems": true
  254. }
  255. },
  256. "working_dir": {"type": "string"}
  257. },
  258. "additionalProperties": false
  259. },
  260. "healthcheck": {
  261. "id": "#/definitions/healthcheck",
  262. "type": "object",
  263. "additionalProperties": false,
  264. "properties": {
  265. "disable": {"type": "boolean"},
  266. "interval": {"type": "string"},
  267. "retries": {"type": "number"},
  268. "test": {
  269. "oneOf": [
  270. {"type": "string"},
  271. {"type": "array", "items": {"type": "string"}}
  272. ]
  273. },
  274. "timeout": {"type": "string"}
  275. }
  276. },
  277. "deployment": {
  278. "id": "#/definitions/deployment",
  279. "type": ["object", "null"],
  280. "properties": {
  281. "mode": {"type": "string"},
  282. "endpoint_mode": {"type": "string"},
  283. "replicas": {"type": "integer"},
  284. "labels": {"$ref": "#/definitions/labels"},
  285. "update_config": {
  286. "type": "object",
  287. "properties": {
  288. "parallelism": {"type": "integer"},
  289. "delay": {"type": "string", "format": "duration"},
  290. "failure_action": {"type": "string"},
  291. "monitor": {"type": "string", "format": "duration"},
  292. "max_failure_ratio": {"type": "number"}
  293. },
  294. "additionalProperties": false
  295. },
  296. "resources": {
  297. "type": "object",
  298. "properties": {
  299. "limits": {"$ref": "#/definitions/resource"},
  300. "reservations": {"$ref": "#/definitions/resource"}
  301. },
  302. "additionalProperties": false
  303. },
  304. "restart_policy": {
  305. "type": "object",
  306. "properties": {
  307. "condition": {"type": "string"},
  308. "delay": {"type": "string", "format": "duration"},
  309. "max_attempts": {"type": "integer"},
  310. "window": {"type": "string", "format": "duration"}
  311. },
  312. "additionalProperties": false
  313. },
  314. "placement": {
  315. "type": "object",
  316. "properties": {
  317. "constraints": {"type": "array", "items": {"type": "string"}}
  318. },
  319. "additionalProperties": false
  320. }
  321. },
  322. "additionalProperties": false
  323. },
  324. "resource": {
  325. "id": "#/definitions/resource",
  326. "type": "object",
  327. "properties": {
  328. "cpus": {"type": "string"},
  329. "memory": {"type": "string"}
  330. },
  331. "additionalProperties": false
  332. },
  333. "network": {
  334. "id": "#/definitions/network",
  335. "type": ["object", "null"],
  336. "properties": {
  337. "driver": {"type": "string"},
  338. "driver_opts": {
  339. "type": "object",
  340. "patternProperties": {
  341. "^.+$": {"type": ["string", "number"]}
  342. }
  343. },
  344. "ipam": {
  345. "type": "object",
  346. "properties": {
  347. "driver": {"type": "string"},
  348. "config": {
  349. "type": "array",
  350. "items": {
  351. "type": "object",
  352. "properties": {
  353. "subnet": {"type": "string", "format": "subnet_ip_address"}
  354. },
  355. "additionalProperties": false
  356. }
  357. }
  358. },
  359. "additionalProperties": false
  360. },
  361. "external": {
  362. "type": ["boolean", "object"],
  363. "properties": {
  364. "name": {"type": "string"}
  365. },
  366. "additionalProperties": false
  367. },
  368. "internal": {"type": "boolean"},
  369. "attachable": {"type": "boolean"},
  370. "labels": {"$ref": "#/definitions/labels"}
  371. },
  372. "additionalProperties": false
  373. },
  374. "volume": {
  375. "id": "#/definitions/volume",
  376. "type": ["object", "null"],
  377. "properties": {
  378. "driver": {"type": "string"},
  379. "driver_opts": {
  380. "type": "object",
  381. "patternProperties": {
  382. "^.+$": {"type": ["string", "number"]}
  383. }
  384. },
  385. "external": {
  386. "type": ["boolean", "object"],
  387. "properties": {
  388. "name": {"type": "string"}
  389. },
  390. "additionalProperties": false
  391. },
  392. "labels": {"$ref": "#/definitions/labels"}
  393. },
  394. "additionalProperties": false
  395. },
  396. "secret": {
  397. "id": "#/definitions/secret",
  398. "type": "object",
  399. "properties": {
  400. "file": {"type": "string"},
  401. "external": {
  402. "type": ["boolean", "object"],
  403. "properties": {
  404. "name": {"type": "string"}
  405. }
  406. },
  407. "labels": {"$ref": "#/definitions/labels"}
  408. },
  409. "additionalProperties": false
  410. },
  411. "string_or_list": {
  412. "oneOf": [
  413. {"type": "string"},
  414. {"$ref": "#/definitions/list_of_strings"}
  415. ]
  416. },
  417. "list_of_strings": {
  418. "type": "array",
  419. "items": {"type": "string"},
  420. "uniqueItems": true
  421. },
  422. "list_or_dict": {
  423. "oneOf": [
  424. {
  425. "type": "object",
  426. "patternProperties": {
  427. ".+": {
  428. "type": ["string", "number", "null"]
  429. }
  430. },
  431. "additionalProperties": false
  432. },
  433. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  434. ]
  435. },
  436. "labels": {
  437. "oneOf": [
  438. {
  439. "type": "object",
  440. "patternProperties": {
  441. ".+": {
  442. "type": "string"
  443. }
  444. },
  445. "additionalProperties": false
  446. },
  447. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  448. ]
  449. },
  450. "constraints": {
  451. "service": {
  452. "id": "#/definitions/constraints/service",
  453. "anyOf": [
  454. {"required": ["build"]},
  455. {"required": ["image"]}
  456. ],
  457. "properties": {
  458. "build": {
  459. "required": ["context"]
  460. }
  461. }
  462. }
  463. }
  464. }
  465. }