config_schema_v3.5.json 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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. "labels": {"$ref": "#/definitions/list_or_dict"},
  147. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  148. "logging": {
  149. "type": "object",
  150. "properties": {
  151. "driver": {"type": "string"},
  152. "options": {
  153. "type": "object",
  154. "patternProperties": {
  155. "^.+$": {"type": ["string", "number", "null"]}
  156. }
  157. }
  158. },
  159. "additionalProperties": false
  160. },
  161. "mac_address": {"type": "string"},
  162. "network_mode": {"type": "string"},
  163. "networks": {
  164. "oneOf": [
  165. {"$ref": "#/definitions/list_of_strings"},
  166. {
  167. "type": "object",
  168. "patternProperties": {
  169. "^[a-zA-Z0-9._-]+$": {
  170. "oneOf": [
  171. {
  172. "type": "object",
  173. "properties": {
  174. "aliases": {"$ref": "#/definitions/list_of_strings"},
  175. "ipv4_address": {"type": "string"},
  176. "ipv6_address": {"type": "string"}
  177. },
  178. "additionalProperties": false
  179. },
  180. {"type": "null"}
  181. ]
  182. }
  183. },
  184. "additionalProperties": false
  185. }
  186. ]
  187. },
  188. "pid": {"type": ["string", "null"]},
  189. "ports": {
  190. "type": "array",
  191. "items": {
  192. "oneOf": [
  193. {"type": "number", "format": "ports"},
  194. {"type": "string", "format": "ports"},
  195. {
  196. "type": "object",
  197. "properties": {
  198. "mode": {"type": "string"},
  199. "target": {"type": "integer"},
  200. "published": {"type": "integer"},
  201. "protocol": {"type": "string"}
  202. },
  203. "additionalProperties": false
  204. }
  205. ]
  206. },
  207. "uniqueItems": true
  208. },
  209. "privileged": {"type": "boolean"},
  210. "read_only": {"type": "boolean"},
  211. "restart": {"type": "string"},
  212. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  213. "shm_size": {"type": ["number", "string"]},
  214. "secrets": {
  215. "type": "array",
  216. "items": {
  217. "oneOf": [
  218. {"type": "string"},
  219. {
  220. "type": "object",
  221. "properties": {
  222. "source": {"type": "string"},
  223. "target": {"type": "string"},
  224. "uid": {"type": "string"},
  225. "gid": {"type": "string"},
  226. "mode": {"type": "number"}
  227. }
  228. }
  229. ]
  230. }
  231. },
  232. "sysctls": {"$ref": "#/definitions/list_or_dict"},
  233. "stdin_open": {"type": "boolean"},
  234. "stop_grace_period": {"type": "string", "format": "duration"},
  235. "stop_signal": {"type": "string"},
  236. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  237. "tty": {"type": "boolean"},
  238. "ulimits": {
  239. "type": "object",
  240. "patternProperties": {
  241. "^[a-z]+$": {
  242. "oneOf": [
  243. {"type": "integer"},
  244. {
  245. "type":"object",
  246. "properties": {
  247. "hard": {"type": "integer"},
  248. "soft": {"type": "integer"}
  249. },
  250. "required": ["soft", "hard"],
  251. "additionalProperties": false
  252. }
  253. ]
  254. }
  255. }
  256. },
  257. "user": {"type": "string"},
  258. "userns_mode": {"type": "string"},
  259. "volumes": {
  260. "type": "array",
  261. "items": {
  262. "oneOf": [
  263. {"type": "string"},
  264. {
  265. "type": "object",
  266. "required": ["type"],
  267. "additionalProperties": false,
  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. }
  288. ],
  289. "uniqueItems": true
  290. }
  291. },
  292. "working_dir": {"type": "string"}
  293. },
  294. "additionalProperties": false
  295. },
  296. "healthcheck": {
  297. "id": "#/definitions/healthcheck",
  298. "type": "object",
  299. "additionalProperties": false,
  300. "properties": {
  301. "disable": {"type": "boolean"},
  302. "interval": {"type": "string"},
  303. "retries": {"type": "number"},
  304. "test": {
  305. "oneOf": [
  306. {"type": "string"},
  307. {"type": "array", "items": {"type": "string"}}
  308. ]
  309. },
  310. "timeout": {"type": "string"}
  311. }
  312. },
  313. "deployment": {
  314. "id": "#/definitions/deployment",
  315. "type": ["object", "null"],
  316. "properties": {
  317. "mode": {"type": "string"},
  318. "endpoint_mode": {"type": "string"},
  319. "replicas": {"type": "integer"},
  320. "labels": {"$ref": "#/definitions/list_or_dict"},
  321. "update_config": {
  322. "type": "object",
  323. "properties": {
  324. "parallelism": {"type": "integer"},
  325. "delay": {"type": "string", "format": "duration"},
  326. "failure_action": {"type": "string"},
  327. "monitor": {"type": "string", "format": "duration"},
  328. "max_failure_ratio": {"type": "number"},
  329. "order": {"type": "string", "enum": [
  330. "start-first", "stop-first"
  331. ]}
  332. },
  333. "additionalProperties": false
  334. },
  335. "resources": {
  336. "type": "object",
  337. "properties": {
  338. "limits": {"$ref": "#/definitions/resource"},
  339. "reservations": {"$ref": "#/definitions/resource"}
  340. },
  341. "additionalProperties": false
  342. },
  343. "restart_policy": {
  344. "type": "object",
  345. "properties": {
  346. "condition": {"type": "string"},
  347. "delay": {"type": "string", "format": "duration"},
  348. "max_attempts": {"type": "integer"},
  349. "window": {"type": "string", "format": "duration"}
  350. },
  351. "additionalProperties": false
  352. },
  353. "placement": {
  354. "type": "object",
  355. "properties": {
  356. "constraints": {"type": "array", "items": {"type": "string"}},
  357. "preferences": {
  358. "type": "array",
  359. "items": {
  360. "type": "object",
  361. "properties": {
  362. "spread": {"type": "string"}
  363. },
  364. "additionalProperties": false
  365. }
  366. }
  367. },
  368. "additionalProperties": false
  369. }
  370. },
  371. "additionalProperties": false
  372. },
  373. "resource": {
  374. "id": "#/definitions/resource",
  375. "type": "object",
  376. "properties": {
  377. "cpus": {"type": "string"},
  378. "memory": {"type": "string"}
  379. },
  380. "additionalProperties": false
  381. },
  382. "network": {
  383. "id": "#/definitions/network",
  384. "type": ["object", "null"],
  385. "properties": {
  386. "driver": {"type": "string"},
  387. "driver_opts": {
  388. "type": "object",
  389. "patternProperties": {
  390. "^.+$": {"type": ["string", "number"]}
  391. }
  392. },
  393. "ipam": {
  394. "type": "object",
  395. "properties": {
  396. "driver": {"type": "string"},
  397. "config": {
  398. "type": "array",
  399. "items": {
  400. "type": "object",
  401. "properties": {
  402. "subnet": {"type": "string", "format": "subnet_ip_address"}
  403. },
  404. "additionalProperties": false
  405. }
  406. }
  407. },
  408. "additionalProperties": false
  409. },
  410. "external": {
  411. "type": ["boolean", "object"],
  412. "properties": {
  413. "name": {"type": "string"}
  414. },
  415. "additionalProperties": false
  416. },
  417. "internal": {"type": "boolean"},
  418. "attachable": {"type": "boolean"},
  419. "labels": {"$ref": "#/definitions/list_or_dict"}
  420. },
  421. "additionalProperties": false
  422. },
  423. "volume": {
  424. "id": "#/definitions/volume",
  425. "type": ["object", "null"],
  426. "properties": {
  427. "name": {"type": "string"},
  428. "driver": {"type": "string"},
  429. "driver_opts": {
  430. "type": "object",
  431. "patternProperties": {
  432. "^.+$": {"type": ["string", "number"]}
  433. }
  434. },
  435. "external": {
  436. "type": ["boolean", "object"],
  437. "properties": {
  438. "name": {"type": "string"}
  439. },
  440. "additionalProperties": false
  441. },
  442. "labels": {"$ref": "#/definitions/list_or_dict"}
  443. },
  444. "additionalProperties": false
  445. },
  446. "secret": {
  447. "id": "#/definitions/secret",
  448. "type": "object",
  449. "properties": {
  450. "file": {"type": "string"},
  451. "external": {
  452. "type": ["boolean", "object"],
  453. "properties": {
  454. "name": {"type": "string"}
  455. }
  456. },
  457. "labels": {"$ref": "#/definitions/list_or_dict"}
  458. },
  459. "additionalProperties": false
  460. },
  461. "config": {
  462. "id": "#/definitions/config",
  463. "type": "object",
  464. "properties": {
  465. "file": {"type": "string"},
  466. "external": {
  467. "type": ["boolean", "object"],
  468. "properties": {
  469. "name": {"type": "string"}
  470. }
  471. },
  472. "labels": {"$ref": "#/definitions/list_or_dict"}
  473. },
  474. "additionalProperties": false
  475. },
  476. "string_or_list": {
  477. "oneOf": [
  478. {"type": "string"},
  479. {"$ref": "#/definitions/list_of_strings"}
  480. ]
  481. },
  482. "list_of_strings": {
  483. "type": "array",
  484. "items": {"type": "string"},
  485. "uniqueItems": true
  486. },
  487. "list_or_dict": {
  488. "oneOf": [
  489. {
  490. "type": "object",
  491. "patternProperties": {
  492. ".+": {
  493. "type": ["string", "number", "null"]
  494. }
  495. },
  496. "additionalProperties": false
  497. },
  498. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  499. ]
  500. },
  501. "constraints": {
  502. "service": {
  503. "id": "#/definitions/constraints/service",
  504. "anyOf": [
  505. {"required": ["build"]},
  506. {"required": ["image"]}
  507. ],
  508. "properties": {
  509. "build": {
  510. "required": ["context"]
  511. }
  512. }
  513. }
  514. }
  515. }
  516. }