service_schema_v2.0.json 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. "type": "array",
  99. "items": {"type": "string"},
  100. "uniqueItems": true
  101. },
  102. "pid": {"type": ["string", "null"]},
  103. "ports": {
  104. "type": "array",
  105. "items": {
  106. "type": ["string", "number"],
  107. "format": "ports"
  108. },
  109. "uniqueItems": true
  110. },
  111. "privileged": {"type": "boolean"},
  112. "read_only": {"type": "boolean"},
  113. "restart": {"type": "string"},
  114. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  115. "stdin_open": {"type": "boolean"},
  116. "stop_signal": {"type": "string"},
  117. "tty": {"type": "boolean"},
  118. "ulimits": {
  119. "type": "object",
  120. "patternProperties": {
  121. "^[a-z]+$": {
  122. "oneOf": [
  123. {"type": "integer"},
  124. {
  125. "type":"object",
  126. "properties": {
  127. "hard": {"type": "integer"},
  128. "soft": {"type": "integer"}
  129. },
  130. "required": ["soft", "hard"],
  131. "additionalProperties": false
  132. }
  133. ]
  134. }
  135. }
  136. },
  137. "user": {"type": "string"},
  138. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  139. "volume_driver": {"type": "string"},
  140. "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  141. "working_dir": {"type": "string"}
  142. },
  143. "dependencies": {
  144. "memswap_limit": ["mem_limit"]
  145. },
  146. "additionalProperties": false
  147. },
  148. "string_or_list": {
  149. "oneOf": [
  150. {"type": "string"},
  151. {"$ref": "#/definitions/list_of_strings"}
  152. ]
  153. },
  154. "list_of_strings": {
  155. "type": "array",
  156. "items": {"type": "string"},
  157. "uniqueItems": true
  158. },
  159. "list_or_dict": {
  160. "oneOf": [
  161. {
  162. "type": "object",
  163. "patternProperties": {
  164. ".+": {
  165. "type": ["string", "number", "boolean", "null"],
  166. "format": "bool-value-in-mapping"
  167. }
  168. },
  169. "additionalProperties": false
  170. },
  171. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  172. ]
  173. },
  174. "constraints": {
  175. "id": "#/definitions/constraints",
  176. "anyOf": [
  177. {"required": ["build"]},
  178. {"required": ["image"]}
  179. ]
  180. }
  181. }
  182. }