service_schema_v1.json 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "service_schema_v1.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. "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  67. "hostname": {"type": "string"},
  68. "image": {"type": "string"},
  69. "ipc": {"type": "string"},
  70. "labels": {"$ref": "#/definitions/list_or_dict"},
  71. "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  72. "log_driver": {"type": "string"},
  73. "log_opt": {"type": "object"},
  74. "mac_address": {"type": "string"},
  75. "mem_limit": {"type": ["number", "string"]},
  76. "memswap_limit": {"type": ["number", "string"]},
  77. "net": {"type": "string"},
  78. "pid": {"type": ["string", "null"]},
  79. "ports": {
  80. "type": "array",
  81. "items": {
  82. "type": ["string", "number"],
  83. "format": "ports"
  84. },
  85. "uniqueItems": true
  86. },
  87. "privileged": {"type": "boolean"},
  88. "read_only": {"type": "boolean"},
  89. "restart": {"type": "string"},
  90. "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  91. "shm_size": {"type": ["number", "string"]},
  92. "stdin_open": {"type": "boolean"},
  93. "stop_signal": {"type": "string"},
  94. "tty": {"type": "boolean"},
  95. "ulimits": {
  96. "type": "object",
  97. "patternProperties": {
  98. "^[a-z]+$": {
  99. "oneOf": [
  100. {"type": "integer"},
  101. {
  102. "type":"object",
  103. "properties": {
  104. "hard": {"type": "integer"},
  105. "soft": {"type": "integer"}
  106. },
  107. "required": ["soft", "hard"],
  108. "additionalProperties": false
  109. }
  110. ]
  111. }
  112. }
  113. },
  114. "user": {"type": "string"},
  115. "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  116. "volume_driver": {"type": "string"},
  117. "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
  118. "working_dir": {"type": "string"}
  119. },
  120. "dependencies": {
  121. "memswap_limit": ["mem_limit"]
  122. },
  123. "additionalProperties": false
  124. },
  125. "string_or_list": {
  126. "oneOf": [
  127. {"type": "string"},
  128. {"$ref": "#/definitions/list_of_strings"}
  129. ]
  130. },
  131. "list_of_strings": {
  132. "type": "array",
  133. "items": {"type": "string"},
  134. "uniqueItems": true
  135. },
  136. "list_or_dict": {
  137. "oneOf": [
  138. {
  139. "type": "object",
  140. "patternProperties": {
  141. ".+": {
  142. "type": ["string", "number", "boolean", "null"],
  143. "format": "bool-value-in-mapping"
  144. }
  145. },
  146. "additionalProperties": false
  147. },
  148. {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
  149. ]
  150. },
  151. "constraints": {
  152. "id": "#/definitions/constraints",
  153. "anyOf": [
  154. {
  155. "required": ["build"],
  156. "not": {"required": ["image"]}
  157. },
  158. {
  159. "required": ["image"],
  160. "not": {"anyOf": [
  161. {"required": ["build"]},
  162. {"required": ["dockerfile"]}
  163. ]}
  164. }
  165. ]
  166. }
  167. }
  168. }