const.py 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import sys
  2. from .version import ComposeVersion
  3. DEFAULT_TIMEOUT = 10
  4. HTTP_TIMEOUT = 60
  5. IS_WINDOWS_PLATFORM = (sys.platform == "win32")
  6. LABEL_CONTAINER_NUMBER = 'com.docker.compose.container-number'
  7. LABEL_ONE_OFF = 'com.docker.compose.oneoff'
  8. LABEL_PROJECT = 'com.docker.compose.project'
  9. LABEL_WORKING_DIR = 'com.docker.compose.project.working_dir'
  10. LABEL_CONFIG_FILES = 'com.docker.compose.project.config_files'
  11. LABEL_ENVIRONMENT_FILE = 'com.docker.compose.project.environment_file'
  12. LABEL_SERVICE = 'com.docker.compose.service'
  13. LABEL_NETWORK = 'com.docker.compose.network'
  14. LABEL_VERSION = 'com.docker.compose.version'
  15. LABEL_SLUG = 'com.docker.compose.slug'
  16. LABEL_VOLUME = 'com.docker.compose.volume'
  17. LABEL_CONFIG_HASH = 'com.docker.compose.config-hash'
  18. NANOCPUS_SCALE = 1000000000
  19. PARALLEL_LIMIT = 64
  20. SECRETS_PATH = '/run/secrets'
  21. WINDOWS_LONGPATH_PREFIX = '\\\\?\\'
  22. COMPOSEFILE_V1 = ComposeVersion('1')
  23. COMPOSEFILE_V2_0 = ComposeVersion('2.0')
  24. COMPOSEFILE_V2_1 = ComposeVersion('2.1')
  25. COMPOSEFILE_V2_2 = ComposeVersion('2.2')
  26. COMPOSEFILE_V2_3 = ComposeVersion('2.3')
  27. COMPOSEFILE_V2_4 = ComposeVersion('2.4')
  28. COMPOSEFILE_V3_0 = ComposeVersion('3.0')
  29. COMPOSEFILE_V3_1 = ComposeVersion('3.1')
  30. COMPOSEFILE_V3_2 = ComposeVersion('3.2')
  31. COMPOSEFILE_V3_3 = ComposeVersion('3.3')
  32. COMPOSEFILE_V3_4 = ComposeVersion('3.4')
  33. COMPOSEFILE_V3_5 = ComposeVersion('3.5')
  34. COMPOSEFILE_V3_6 = ComposeVersion('3.6')
  35. COMPOSEFILE_V3_7 = ComposeVersion('3.7')
  36. COMPOSEFILE_V3_8 = ComposeVersion('3.8')
  37. # minimum DOCKER ENGINE API version needed to support
  38. # features for each compose schema version
  39. API_VERSIONS = {
  40. COMPOSEFILE_V1: '1.21',
  41. COMPOSEFILE_V2_0: '1.22',
  42. COMPOSEFILE_V2_1: '1.24',
  43. COMPOSEFILE_V2_2: '1.25',
  44. COMPOSEFILE_V2_3: '1.30',
  45. COMPOSEFILE_V2_4: '1.35',
  46. COMPOSEFILE_V3_0: '1.25',
  47. COMPOSEFILE_V3_1: '1.25',
  48. COMPOSEFILE_V3_2: '1.25',
  49. COMPOSEFILE_V3_3: '1.30',
  50. COMPOSEFILE_V3_4: '1.30',
  51. COMPOSEFILE_V3_5: '1.30',
  52. COMPOSEFILE_V3_6: '1.36',
  53. COMPOSEFILE_V3_7: '1.38',
  54. COMPOSEFILE_V3_8: '1.38',
  55. }
  56. API_VERSION_TO_ENGINE_VERSION = {
  57. API_VERSIONS[COMPOSEFILE_V1]: '1.9.0',
  58. API_VERSIONS[COMPOSEFILE_V2_0]: '1.10.0',
  59. API_VERSIONS[COMPOSEFILE_V2_1]: '1.12.0',
  60. API_VERSIONS[COMPOSEFILE_V2_2]: '1.13.0',
  61. API_VERSIONS[COMPOSEFILE_V2_3]: '17.06.0',
  62. API_VERSIONS[COMPOSEFILE_V2_4]: '17.12.0',
  63. API_VERSIONS[COMPOSEFILE_V3_0]: '1.13.0',
  64. API_VERSIONS[COMPOSEFILE_V3_1]: '1.13.0',
  65. API_VERSIONS[COMPOSEFILE_V3_2]: '1.13.0',
  66. API_VERSIONS[COMPOSEFILE_V3_3]: '17.06.0',
  67. API_VERSIONS[COMPOSEFILE_V3_4]: '17.06.0',
  68. API_VERSIONS[COMPOSEFILE_V3_5]: '17.06.0',
  69. API_VERSIONS[COMPOSEFILE_V3_6]: '18.02.0',
  70. API_VERSIONS[COMPOSEFILE_V3_7]: '18.06.0',
  71. API_VERSIONS[COMPOSEFILE_V3_8]: '18.06.0',
  72. }