schema.json 4.2 KB

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