config_schema_v3.5.json 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "config_schema_v3.5.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. "configs": {
  50. "id": "#/properties/configs",
  51. "type": "object",
  52. "patternProperties": {
  53. "^[a-zA-Z0-9._-]+$": {
  54. "$ref": "#/definitions/config"
  55. }
  56. },
  57. "additionalProperties": false
  58. }
  59. },
  60. "patternProperties": {"^x-": {}},
  61. "additionalProperties": false,
  62. "definitions": {
  63. "service": {
  64. "id": "#/definitions/service",
  65. "type": "object",
  66. "properties": {
  67. "deploy": {"$ref": "#/definitions/deployment"},
  68. "build": {
  69. "oneOf": [
  70. {"type": "string"},
  71. {
  72. "type": "object",
  73. "properties": {
  74. "context": {"type": "string"},
  75. "dockerfile": {"type": "string"},
  76. "args": {"$ref": "#/definitions/list_or_dict"},
  77. "labels": {"$ref": "#/definitions/list_or_dict"},
  78. "cache_from": {"$ref": "#/definitions/list_of_strings"},
  79. "network": {"type": "string"},
  80. "target": {"type": "string"},
  81. "shm_size": {"type": ["integer", "string"]}
  82. },
  83. "additionalProperties": false
  84. }
  85. ]
  86. },
  87. "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  88. "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  89. "cgroup_parent": {"type": "string"},
  90. "command": {
  91. "oneOf": [
  92. {"type": "string"},
  93. {"type": "array", "items": {"type": "string"}}
  94. ]
  95. },
  96. "configs": {
  97. "type": "array",
  98. "items": {
  99. "oneOf": [
  100. {"type": "string"},
  101. {
  102. "type": "object",
  103. "properties": {
  104. "source": {"type": "string"},
  105. "target": {"type": "string"},
  106. "uid": {"type": "string"},
  107. "gid": {"type": "string"},
  108. "mode": {"type": "number"}
  109. }
  110. }
  111. ]
  112. }
  113. },
  114. "container_name": {"type": "string"},
  115. "credential_spec": {"type": "object", "properties": {
  116. "file": {"type": "string"},
  117. "registry": {"type": "string"}
  118. }},
  119. "depends_on": {"$ref": "#/definitions/list_of_strings"},
  120. "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  121. "dns": {"$ref": "#/definitions/string_or_list"},
  122. "dns_search": {"$ref": "#/definitions/string_or_list"},
  123. "domainname": {"type": "string"},
  124. "entrypoint": {
  125. "oneOf": [
  126. {"type": "string"},
  127. {"type": "array", "items": {"type": "string"}}
  128. ]
  129. },
  130. "env_file": {"$ref": "#/definitions/string_or_list"},
  131. "environment": {"$ref": "#/definitions/list_or_dict"},
  132. "expose": {
  133. "type": "array",
  134. "items": {
  135. "type": ["string", "number"],
  136. "format": "expose"
  137. },
  138. "uniqueItems": true
  139. },
  140. "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  141. "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
  142. "healthcheck": {"$ref": "#/definitions/healthcheck"},
  143. "hostname": {"type": "string"},
  144. "image": {"type": "string"},
  145. "ipc": {"type": "string"},
  146. "isolation": {"type": "string"},
  147. "labels": {"$ref": "#/definitions/list_or_dict"},
  148. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  149. "logging": {
  150. "type": "object",
  151. "properties": {
  152. "driver": {"type": "string"},
  153. "options": {
  154. "type": "object",
  155. "patternProperties": {
  156. "^.+$": {"type": ["string", "number", "null"]}
  157. }
  158. }
  159. },
  160. "additionalProperties": false
  161. },
  162. "mac_address": {"type": "string"},
  163. "network_mode": {"type": "string"},
  164. "networks": {
  165. "oneOf": [
  166. {"$ref": "#/definitions/list_of_strings"},
  167. {
  168. "type": "object",
  169. "patternProperties": {
  170. "^[a-zA-Z0-9._-]+$": {
  171. "oneOf": [
  172. {
  173. "type": "object",
  174. "properties": {
  175. "aliases": {"$ref": "#/definitions/list_of_strings"},
  176. "ipv4_address": {"type": "string"},
  177. "ipv6_address": {"type": "string"}
  178. },
  179. "additionalProperties": false
  180. },
  181. {"type": "null"}
  182. ]
  183. }
  184. },
  185. "additionalProperties": false
  186. }
  187. ]
  188. },
  189. "pid": {"type": ["string", "null"]},
  190. "ports": {
  191. "type": "array",
  192. "items": {
  193. "oneOf": [
  194. {"type": "number", "format": "ports"},
  195. {"type": "string", "format": "ports"},
  196. {
  197. "type": "object",
  198. "properties": {
  199. "mode": {"type": "string"},
  200. "target": {"type": "integer"},
  201. "published": {"type": "integer"},
  202. "protocol": {"type": "string"}
  203. },
  204. "additionalProperties": false
  205. }
  206. ]
  207. },
  208. "uniqueItems": true
  209. },
  210. "privileged": {"type": "boolean"},
  211. "read_only": {"type": "boolean"},
  212. "restart": {"type": "string"},
  213. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  214. "shm_size": {"type": ["number", "string"]},
  215. "secrets": {
  216. "type": "array",
  217. "items": {
  218. "oneOf": [
  219. {"type": "string"},
  220. {
  221. "type": "object",
  222. "properties": {
  223. "source": {"type": "string"},
  224. "target": {"type": "string"},
  225. "uid": {"type": "string"},
  226. "gid": {"type": "string"},
  227. "mode": {"type": "number"}
  228. }
  229. }
  230. ]
  231. }
  232. },
  233. "sysctls": {"$ref": "#/definitions/list_or_dict"},
  234. "stdin_open": {"type": "boolean"},
  235. "stop_grace_period": {"type": "string", "format": "duration"},
  236. "stop_signal": {"type": "string"},
  237. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  238. "tty": {"type": "boolean"},
  239. "ulimits": {
  240. "type": "object",
  241. "patternProperties": {
  242. "^[a-z]+$": {
  243. "oneOf": [
  244. {"type": "integer"},
  245. {
  246. "type":"object",
  247. "properties": {
  248. "hard": {"type": "integer"},
  249. "soft": {"type": "integer"}
  250. },
  251. "required": ["soft", "hard"],
  252. "additionalProperties": false
  253. }
  254. ]
  255. }
  256. }
  257. },
  258. "user": {"type": "string"},
  259. "userns_mode": {"type": "string"},
  260. "volumes": {
  261. "type": "array",
  262. "items": {
  263. "oneOf": [
  264. {"type": "string"},
  265. {
  266. "type": "object",
  267. "required": ["type"],
  268. "properties": {
  269. "type": {"type": "string"},
  270. "source": {"type": "string"},
  271. "target": {"type": "string"},
  272. "read_only": {"type": "boolean"},
  273. "consistency": {"type": "string"},
  274. "bind": {
  275. "type": "object",
  276. "properties": {
  277. "propagation": {"type": "string"}
  278. }
  279. },
  280. "volume": {
  281. "type": "object",
  282. "properties": {
  283. "nocopy": {"type": "boolean"}
  284. }
  285. }
  286. },
  287. "additionalProperties": false
  288. }
  289. ],
  290. "uniqueItems": true
  291. }
  292. },
  293. "working_dir": {"type": "string"}
  294. },
  295. "additionalProperties": false
  296. },
  297. "healthcheck": {
  298. "id": "#/definitions/healthcheck",
  299. "type": "object",
  300. "additionalProperties": false,
  301. "properties": {
  302. "disable": {"type": "boolean"},
  303. "interval": {"type": "string", "format": "duration"},
  304. "retries": {"type": "number"},
  305. "test": {
  306. "oneOf": [
  307. {"type": "string"},
  308. {"type": "array", "items": {"type": "string"}}
  309. ]
  310. },
  311. "timeout": {"type": "string", "format": "duration"},
  312. "start_period": {"type": "string", "format": "duration"}
  313. }
  314. },
  315. "deployment": {
  316. "id": "#/definitions/deployment",
  317. "type": ["object", "null"],
  318. "properties": {
  319. "mode": {"type": "string"},
  320. "endpoint_mode": {"type": "string"},
  321. "replicas": {"type": "integer"},
  322. "labels": {"$ref": "#/definitions/list_or_dict"},
  323. "update_config": {
  324. "type": "object",
  325. "properties": {
  326. "parallelism": {"type": "integer"},
  327. "delay": {"type": "string", "format": "duration"},
  328. "failure_action": {"type": "string"},
  329. "monitor": {"type": "string", "format": "duration"},
  330. "max_failure_ratio": {"type": "number"},
  331. "order": {"type": "string", "enum": [
  332. "start-first", "stop-first"
  333. ]}
  334. },
  335. "additionalProperties": false
  336. },
  337. "resources": {
  338. "type": "object",
  339. "properties": {
  340. "limits": {
  341. "type": "object",
  342. "properties": {
  343. "cpus": {"type": "string"},
  344. "memory": {"type": "string"}
  345. },
  346. "additionalProperties": false
  347. },
  348. "reservations": {
  349. "type": "object",
  350. "properties": {
  351. "cpus": {"type": "string"},
  352. "memory": {"type": "string"},
  353. "generic_resources": {"$ref": "#/definitions/generic_resources"}
  354. },
  355. "additionalProperties": false
  356. }
  357. },
  358. "additionalProperties": false
  359. },
  360. "restart_policy": {
  361. "type": "object",
  362. "properties": {
  363. "condition": {"type": "string"},
  364. "delay": {"type": "string", "format": "duration"},
  365. "max_attempts": {"type": "integer"},
  366. "window": {"type": "string", "format": "duration"}
  367. },
  368. "additionalProperties": false
  369. },
  370. "placement": {
  371. "type": "object",
  372. "properties": {
  373. "constraints": {"type": "array", "items": {"type": "string"}},
  374. "preferences": {
  375. "type": "array",
  376. "items": {
  377. "type": "object",
  378. "properties": {
  379. "spread": {"type": "string"}
  380. },
  381. "additionalProperties": false
  382. }
  383. }
  384. },
  385. "additionalProperties": false
  386. }
  387. },
  388. "additionalProperties": false
  389. },
  390. "generic_resources": {
  391. "id": "#/definitions/generic_resources",
  392. "type": "array",
  393. "items": {
  394. "type": "object",
  395. "properties": {
  396. "discrete_resource_spec": {
  397. "type": "object",
  398. "properties": {
  399. "kind": {"type": "string"},
  400. "value": {"type": "number"}
  401. },
  402. "additionalProperties": false
  403. }
  404. },
  405. "additionalProperties": false
  406. }
  407. },
  408. "network": {
  409. "id": "#/definitions/network",
  410. "type": ["object", "null"],
  411. "properties": {
  412. "name": {"type": "string"},
  413. "driver": {"type": "string"},
  414. "driver_opts": {
  415. "type": "object",
  416. "patternProperties": {
  417. "^.+$": {"type": ["string", "number"]}
  418. }
  419. },
  420. "ipam": {
  421. "type": "object",
  422. "properties": {
  423. "driver": {"type": "string"},
  424. "config": {
  425. "type": "array",
  426. "items": {
  427. "type": "object",
  428. "properties": {
  429. "subnet": {"type": "string", "format": "subnet_ip_address"}
  430. },
  431. "additionalProperties": false
  432. }
  433. }
  434. },
  435. "additionalProperties": false
  436. },
  437. "external": {
  438. "type": ["boolean", "object"],
  439. "properties": {
  440. "name": {"type": "string"}
  441. },
  442. "additionalProperties": false
  443. },
  444. "internal": {"type": "boolean"},
  445. "attachable": {"type": "boolean"},
  446. "labels": {"$ref": "#/definitions/list_or_dict"}
  447. },
  448. "additionalProperties": false
  449. },
  450. "volume": {
  451. "id": "#/definitions/volume",
  452. "type": ["object", "null"],
  453. "properties": {
  454. "name": {"type": "string"},
  455. "driver": {"type": "string"},
  456. "driver_opts": {
  457. "type": "object",
  458. "patternProperties": {
  459. "^.+$": {"type": ["string", "number"]}
  460. }
  461. },
  462. "external": {
  463. "type": ["boolean", "object"],
  464. "properties": {
  465. "name": {"type": "string"}
  466. },
  467. "additionalProperties": false
  468. },
  469. "labels": {"$ref": "#/definitions/list_or_dict"}
  470. },
  471. "additionalProperties": false
  472. },
  473. "secret": {
  474. "id": "#/definitions/secret",
  475. "type": "object",
  476. "properties": {
  477. "name": {"type": "string"},
  478. "file": {"type": "string"},
  479. "external": {
  480. "type": ["boolean", "object"],
  481. "properties": {
  482. "name": {"type": "string"}
  483. }
  484. },
  485. "labels": {"$ref": "#/definitions/list_or_dict"}
  486. },
  487. "additionalProperties": false
  488. },
  489. "config": {
  490. "id": "#/definitions/config",
  491. "type": "object",
  492. "properties": {
  493. "name": {"type": "string"},
  494. "file": {"type": "string"},
  495. "external": {
  496. "type": ["boolean", "object"],
  497. "properties": {
  498. "name": {"type": "string"}
  499. }
  500. },
  501. "labels": {"$ref": "#/definitions/list_or_dict"}
  502. },
  503. "additionalProperties": false
  504. },
  505. "string_or_list": {
  506. "oneOf": [
  507. {"type": "string"},
  508. {"$ref": "#/definitions/list_of_strings"}
  509. ]
  510. },
  511. "list_of_strings": {
  512. "type": "array",
  513. "items": {"type": "string"},
  514. "uniqueItems": true
  515. },
  516. "list_or_dict": {
  517. "oneOf": [
  518. {
  519. "type": "object",
  520. "patternProperties": {
  521. ".+": {
  522. "type": ["string", "number", "null"]
  523. }
  524. },
  525. "additionalProperties": false
  526. },
  527. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  528. ]
  529. },
  530. "constraints": {
  531. "service": {
  532. "id": "#/definitions/constraints/service",
  533. "anyOf": [
  534. {"required": ["build"]},
  535. {"required": ["image"]}
  536. ],
  537. "properties": {
  538. "build": {
  539. "required": ["context"]
  540. }
  541. }
  542. }
  543. }
  544. }
  545. }