service_schema_v2.json 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "service_schema_v2.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": {"type": "string"},
  15. "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  16. "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  17. "cgroup_parent": {"type": "string"},
  18. "command": {
  19. "oneOf": [
  20. {"type": "string"},
  21. {"type": "array", "items": {"type": "string"}}
  22. ]
  23. },
  24. "container_name": {"type": "string"},
  25. "cpu_shares": {"type": ["number", "string"]},
  26. "cpu_quota": {"type": ["number", "string"]},
  27. "cpuset": {"type": "string"},
  28. "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  29. "dns": {"$ref": "#/definitions/string_or_list"},
  30. "dns_search": {"$ref": "#/definitions/string_or_list"},
  31. "dockerfile": {"type": "string"},
  32. "domainname": {"type": "string"},
  33. "entrypoint": {
  34. "oneOf": [
  35. {"type": "string"},
  36. {"type": "array", "items": {"type": "string"}}
  37. ]
  38. },
  39. "env_file": {"$ref": "#/definitions/string_or_list"},
  40. "environment": {"$ref": "#/definitions/list_or_dict"},
  41. "expose": {
  42. "type": "array",
  43. "items": {
  44. "type": ["string", "number"],
  45. "format": "expose"
  46. },
  47. "uniqueItems": true
  48. },
  49. "extends": {
  50. "oneOf": [
  51. {
  52. "type": "string"
  53. },
  54. {
  55. "type": "object",
  56. "properties": {
  57. "service": {"type": "string"},
  58. "file": {"type": "string"}
  59. },
  60. "required": ["service"],
  61. "additionalProperties": false
  62. }
  63. ]
  64. },
  65. "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
  66. "hostname": {"type": "string"},
  67. "image": {"type": "string"},
  68. "ipc": {"type": "string"},
  69. "labels": {"$ref": "#/definitions/list_or_dict"},
  70. "logging": {
  71. "type": "object",
  72. "properties": {
  73. "driver": {"type": "string"},
  74. "options": {"type": "object"}
  75. },
  76. "additionalProperties": false
  77. },
  78. "mac_address": {"type": "string"},
  79. "mem_limit": {"type": ["number", "string"]},
  80. "memswap_limit": {"type": ["number", "string"]},
  81. "networks": {
  82. "type": "array",
  83. "items": {"type": "string"},
  84. "uniqueItems": true
  85. },
  86. "pid": {"type": ["string", "null"]},
  87. "ports": {
  88. "type": "array",
  89. "items": {
  90. "type": ["string", "number"],
  91. "format": "ports"
  92. },
  93. "uniqueItems": true
  94. },
  95. "privileged": {"type": "boolean"},
  96. "read_only": {"type": "boolean"},
  97. "restart": {"type": "string"},
  98. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  99. "stdin_open": {"type": "boolean"},
  100. "stop_signal": {"type": "string"},
  101. "tty": {"type": "boolean"},
  102. "ulimits": {
  103. "type": "object",
  104. "patternProperties": {
  105. "^[a-z]+$": {
  106. "oneOf": [
  107. {"type": "integer"},
  108. {
  109. "type":"object",
  110. "properties": {
  111. "hard": {"type": "integer"},
  112. "soft": {"type": "integer"}
  113. },
  114. "required": ["soft", "hard"],
  115. "additionalProperties": false
  116. }
  117. ]
  118. }
  119. }
  120. },
  121. "user": {"type": "string"},
  122. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  123. "volume_driver": {"type": "string"},
  124. "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  125. "working_dir": {"type": "string"}
  126. },
  127. "dependencies": {
  128. "memswap_limit": ["mem_limit"]
  129. },
  130. "additionalProperties": false
  131. },
  132. "string_or_list": {
  133. "oneOf": [
  134. {"type": "string"},
  135. {"$ref": "#/definitions/list_of_strings"}
  136. ]
  137. },
  138. "list_of_strings": {
  139. "type": "array",
  140. "items": {"type": "string"},
  141. "uniqueItems": true
  142. },
  143. "list_or_dict": {
  144. "oneOf": [
  145. {
  146. "type": "object",
  147. "patternProperties": {
  148. ".+": {
  149. "type": ["string", "number", "boolean", "null"],
  150. "format": "bool-value-in-mapping"
  151. }
  152. },
  153. "additionalProperties": false
  154. },
  155. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  156. ]
  157. },
  158. "constraints": {
  159. "id": "#/definitions/constraints",
  160. "anyOf": [
  161. {"required": ["build"]},
  162. {"required": ["image"]}
  163. ]
  164. }
  165. }
  166. }