config_schema_v3.4.json 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "config_schema_v3.4.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/labels"},
  78. "cache_from": {"$ref": "#/definitions/list_of_strings"},
  79. "network": {"type": "string"},
  80. "target": {"type": "string"}
  81. },
  82. "additionalProperties": false
  83. }
  84. ]
  85. },
  86. "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  87. "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  88. "cgroup_parent": {"type": "string"},
  89. "command": {
  90. "oneOf": [
  91. {"type": "string"},
  92. {"type": "array", "items": {"type": "string"}}
  93. ]
  94. },
  95. "configs": {
  96. "type": "array",
  97. "items": {
  98. "oneOf": [
  99. {"type": "string"},
  100. {
  101. "type": "object",
  102. "properties": {
  103. "source": {"type": "string"},
  104. "target": {"type": "string"},
  105. "uid": {"type": "string"},
  106. "gid": {"type": "string"},
  107. "mode": {"type": "number"}
  108. }
  109. }
  110. ]
  111. }
  112. },
  113. "container_name": {"type": "string"},
  114. "credential_spec": {"type": "object", "properties": {
  115. "file": {"type": "string"},
  116. "registry": {"type": "string"}
  117. }},
  118. "depends_on": {"$ref": "#/definitions/list_of_strings"},
  119. "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  120. "dns": {"$ref": "#/definitions/string_or_list"},
  121. "dns_search": {"$ref": "#/definitions/string_or_list"},
  122. "domainname": {"type": "string"},
  123. "entrypoint": {
  124. "oneOf": [
  125. {"type": "string"},
  126. {"type": "array", "items": {"type": "string"}}
  127. ]
  128. },
  129. "env_file": {"$ref": "#/definitions/string_or_list"},
  130. "environment": {"$ref": "#/definitions/list_or_dict"},
  131. "expose": {
  132. "type": "array",
  133. "items": {
  134. "type": ["string", "number"],
  135. "format": "expose"
  136. },
  137. "uniqueItems": true
  138. },
  139. "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  140. "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
  141. "healthcheck": {"$ref": "#/definitions/healthcheck"},
  142. "hostname": {"type": "string"},
  143. "image": {"type": "string"},
  144. "ipc": {"type": "string"},
  145. "labels": {"$ref": "#/definitions/labels"},
  146. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  147. "logging": {
  148. "type": "object",
  149. "properties": {
  150. "driver": {"type": "string"},
  151. "options": {
  152. "type": "object",
  153. "patternProperties": {
  154. "^.+$": {"type": ["string", "number", "null"]}
  155. }
  156. }
  157. },
  158. "additionalProperties": false
  159. },
  160. "mac_address": {"type": "string"},
  161. "network_mode": {"type": "string"},
  162. "networks": {
  163. "oneOf": [
  164. {"$ref": "#/definitions/list_of_strings"},
  165. {
  166. "type": "object",
  167. "patternProperties": {
  168. "^[a-zA-Z0-9._-]+$": {
  169. "oneOf": [
  170. {
  171. "type": "object",
  172. "properties": {
  173. "aliases": {"$ref": "#/definitions/list_of_strings"},
  174. "ipv4_address": {"type": "string"},
  175. "ipv6_address": {"type": "string"}
  176. },
  177. "additionalProperties": false
  178. },
  179. {"type": "null"}
  180. ]
  181. }
  182. },
  183. "additionalProperties": false
  184. }
  185. ]
  186. },
  187. "pid": {"type": ["string", "null"]},
  188. "ports": {
  189. "type": "array",
  190. "items": {
  191. "oneOf": [
  192. {"type": "number", "format": "ports"},
  193. {"type": "string", "format": "ports"},
  194. {
  195. "type": "object",
  196. "properties": {
  197. "mode": {"type": "string"},
  198. "target": {"type": "integer"},
  199. "published": {"type": "integer"},
  200. "protocol": {"type": "string"}
  201. },
  202. "additionalProperties": false
  203. }
  204. ]
  205. },
  206. "uniqueItems": true
  207. },
  208. "privileged": {"type": "boolean"},
  209. "read_only": {"type": "boolean"},
  210. "restart": {"type": "string"},
  211. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  212. "shm_size": {"type": ["number", "string"]},
  213. "secrets": {
  214. "type": "array",
  215. "items": {
  216. "oneOf": [
  217. {"type": "string"},
  218. {
  219. "type": "object",
  220. "properties": {
  221. "source": {"type": "string"},
  222. "target": {"type": "string"},
  223. "uid": {"type": "string"},
  224. "gid": {"type": "string"},
  225. "mode": {"type": "number"}
  226. }
  227. }
  228. ]
  229. }
  230. },
  231. "sysctls": {"$ref": "#/definitions/list_or_dict"},
  232. "stdin_open": {"type": "boolean"},
  233. "stop_grace_period": {"type": "string", "format": "duration"},
  234. "stop_signal": {"type": "string"},
  235. "tmpfs": {"$ref": "#/definitions/string_or_list"},
  236. "tty": {"type": "boolean"},
  237. "ulimits": {
  238. "type": "object",
  239. "patternProperties": {
  240. "^[a-z]+$": {
  241. "oneOf": [
  242. {"type": "integer"},
  243. {
  244. "type":"object",
  245. "properties": {
  246. "hard": {"type": "integer"},
  247. "soft": {"type": "integer"}
  248. },
  249. "required": ["soft", "hard"],
  250. "additionalProperties": false
  251. }
  252. ]
  253. }
  254. }
  255. },
  256. "user": {"type": "string"},
  257. "userns_mode": {"type": "string"},
  258. "volumes": {
  259. "type": "array",
  260. "items": {
  261. "oneOf": [
  262. {"type": "string"},
  263. {
  264. "type": "object",
  265. "required": ["type"],
  266. "additionalProperties": false,
  267. "properties": {
  268. "type": {"type": "string"},
  269. "source": {"type": "string"},
  270. "target": {"type": "string"},
  271. "read_only": {"type": "boolean"},
  272. "consistency": {"type": "string"},
  273. "bind": {
  274. "type": "object",
  275. "properties": {
  276. "propagation": {"type": "string"}
  277. }
  278. },
  279. "volume": {
  280. "type": "object",
  281. "properties": {
  282. "nocopy": {"type": "boolean"}
  283. }
  284. }
  285. }
  286. }
  287. ],
  288. "uniqueItems": true
  289. }
  290. },
  291. "working_dir": {"type": "string"}
  292. },
  293. "additionalProperties": false
  294. },
  295. "healthcheck": {
  296. "id": "#/definitions/healthcheck",
  297. "type": "object",
  298. "additionalProperties": false,
  299. "properties": {
  300. "disable": {"type": "boolean"},
  301. "interval": {"type": "string", "format": "duration"},
  302. "retries": {"type": "number"},
  303. "test": {
  304. "oneOf": [
  305. {"type": "string"},
  306. {"type": "array", "items": {"type": "string"}}
  307. ]
  308. },
  309. "timeout": {"type": "string", "format": "duration"},
  310. "start_period": {"type": "string", "format": "duration"}
  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/labels"},
  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/labels"}
  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/labels"}
  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/labels"}
  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/labels"}
  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. "labels": {
  502. "oneOf": [
  503. {
  504. "type": "object",
  505. "patternProperties": {
  506. ".+": {
  507. "type": "string"
  508. }
  509. },
  510. "additionalProperties": false
  511. },
  512. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  513. ]
  514. },
  515. "constraints": {
  516. "service": {
  517. "id": "#/definitions/constraints/service",
  518. "anyOf": [
  519. {"required": ["build"]},
  520. {"required": ["image"]}
  521. ],
  522. "properties": {
  523. "build": {
  524. "required": ["context"]
  525. }
  526. }
  527. }
  528. }
  529. }
  530. }