config_schema_v3.3.json 15 KB

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