service_schema_v2.0.json 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "service_schema_v2.0.json",
  4. "type": "object",
  5. "allOf": [
  6. {"$ref": "#/definitions/service"},
  7. {"$ref": "#/definitions/constraints"}
  8. ],
  9. "definitions": {
  10. "service": {
  11. "id": "#/definitions/service",
  12. "type": "object",
  13. "properties": {
  14. "build": {
  15. "oneOf": [
  16. {"type": "string"},
  17. {
  18. "type": "object",
  19. "properties": {
  20. "context": {"type": "string"},
  21. "dockerfile": {"type": "string"},
  22. "args": {
  23. "oneOf": [
  24. {"$ref": "#/definitions/list_of_strings"},
  25. {
  26. "type": "object",
  27. "patternProperties": {
  28. "^.+$": {
  29. "type": ["string", "number"]
  30. }
  31. },
  32. "additionalProperties": false
  33. }
  34. ]
  35. }
  36. },
  37. "additionalProperties": false
  38. }
  39. ]
  40. },
  41. "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  42. "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  43. "cgroup_parent": {"type": "string"},
  44. "command": {
  45. "oneOf": [
  46. {"type": "string"},
  47. {"type": "array", "items": {"type": "string"}}
  48. ]
  49. },
  50. "container_name": {"type": "string"},
  51. "cpu_shares": {"type": ["number", "string"]},
  52. "cpu_quota": {"type": ["number", "string"]},
  53. "cpuset": {"type": "string"},
  54. "depends_on": {"$ref": "#/definitions/list_of_strings"},
  55. "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  56. "dns": {"$ref": "#/definitions/string_or_list"},
  57. "dns_search": {"$ref": "#/definitions/string_or_list"},
  58. "domainname": {"type": "string"},
  59. "entrypoint": {
  60. "oneOf": [
  61. {"type": "string"},
  62. {"type": "array", "items": {"type": "string"}}
  63. ]
  64. },
  65. "env_file": {"$ref": "#/definitions/string_or_list"},
  66. "environment": {"$ref": "#/definitions/list_or_dict"},
  67. "expose": {
  68. "type": "array",
  69. "items": {
  70. "type": ["string", "number"],
  71. "format": "expose"
  72. },
  73. "uniqueItems": true
  74. },
  75. "extends": {
  76. "oneOf": [
  77. {
  78. "type": "string"
  79. },
  80. {
  81. "type": "object",
  82. "properties": {
  83. "service": {"type": "string"},
  84. "file": {"type": "string"}
  85. },
  86. "required": ["service"],
  87. "additionalProperties": false
  88. }
  89. ]
  90. },
  91. "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  92. "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
  93. "hostname": {"type": "string"},
  94. "image": {"type": "string"},
  95. "ipc": {"type": "string"},
  96. "labels": {"$ref": "#/definitions/list_or_dict"},
  97. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  98. "logging": {
  99. "type": "object",
  100. "properties": {
  101. "driver": {"type": "string"},
  102. "options": {"type": "object"}
  103. },
  104. "additionalProperties": false
  105. },
  106. "mac_address": {"type": "string"},
  107. "mem_limit": {"type": ["number", "string"]},
  108. "memswap_limit": {"type": ["number", "string"]},
  109. "network_mode": {"type": "string"},
  110. "networks": {
  111. "oneOf": [
  112. {"$ref": "#/definitions/list_of_strings"},
  113. {
  114. "type": "object",
  115. "patternProperties": {
  116. "^[a-zA-Z0-9._-]+$": {
  117. "oneOf": [
  118. {
  119. "type": "object",
  120. "properties": {
  121. "aliases": {"$ref": "#/definitions/list_of_strings"}
  122. },
  123. "additionalProperties": false
  124. },
  125. {"type": "null"}
  126. ]
  127. }
  128. },
  129. "additionalProperties": false
  130. }
  131. ]
  132. },
  133. "pid": {"type": ["string", "null"]},
  134. "ports": {
  135. "type": "array",
  136. "items": {
  137. "type": ["string", "number"],
  138. "format": "ports"
  139. },
  140. "uniqueItems": true
  141. },
  142. "privileged": {"type": "boolean"},
  143. "read_only": {"type": "boolean"},
  144. "restart": {"type": "string"},
  145. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  146. "shm_size": {"type": ["number", "string"]},
  147. "stdin_open": {"type": "boolean"},
  148. "stop_signal": {"type": "string"},
  149. "tty": {"type": "boolean"},
  150. "ulimits": {
  151. "type": "object",
  152. "patternProperties": {
  153. "^[a-z]+$": {
  154. "oneOf": [
  155. {"type": "integer"},
  156. {
  157. "type":"object",
  158. "properties": {
  159. "hard": {"type": "integer"},
  160. "soft": {"type": "integer"}
  161. },
  162. "required": ["soft", "hard"],
  163. "additionalProperties": false
  164. }
  165. ]
  166. }
  167. }
  168. },
  169. "user": {"type": "string"},
  170. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  171. "volume_driver": {"type": "string"},
  172. "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  173. "working_dir": {"type": "string"}
  174. },
  175. "dependencies": {
  176. "memswap_limit": ["mem_limit"]
  177. },
  178. "additionalProperties": false
  179. },
  180. "string_or_list": {
  181. "oneOf": [
  182. {"type": "string"},
  183. {"$ref": "#/definitions/list_of_strings"}
  184. ]
  185. },
  186. "list_of_strings": {
  187. "type": "array",
  188. "items": {"type": "string"},
  189. "uniqueItems": true
  190. },
  191. "list_or_dict": {
  192. "oneOf": [
  193. {
  194. "type": "object",
  195. "patternProperties": {
  196. ".+": {
  197. "type": ["string", "number", "boolean", "null"],
  198. "format": "bool-value-in-mapping"
  199. }
  200. },
  201. "additionalProperties": false
  202. },
  203. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  204. ]
  205. },
  206. "constraints": {
  207. "id": "#/definitions/constraints",
  208. "anyOf": [
  209. {"required": ["build"]},
  210. {"required": ["image"]}
  211. ],
  212. "properties": {
  213. "build": {
  214. "required": ["context"]
  215. }
  216. }
  217. }
  218. }
  219. }