service_schema_v2.0.json 6.4 KB

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