config_schema_v1.json 5.4 KB

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