本文整理汇总了Python中docker.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python docker.__version__方法的具体用法?Python docker.__version__怎么用?Python docker.__version__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docker
的用法示例。
在下文中一共展示了docker.__version__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_version_info
# 需要导入模块: import docker [as 别名]
# 或者: from docker import __version__ [as 别名]
def get_version_info(scope):
versioninfo = 'docker-compose version {}, build {}'.format(
compose.__version__,
get_build_version())
if scope == 'compose':
return versioninfo
if scope == 'full':
return (
"{}\n"
"docker-py version: {}\n"
"{} version: {}\n"
"OpenSSL version: {}"
).format(
versioninfo,
docker.version,
platform.python_implementation(),
platform.python_version(),
ssl.OPENSSL_VERSION)
raise ValueError("{} is not a valid version scope".format(scope))
示例2: generate_user_agent
# 需要导入模块: import docker [as 别名]
# 或者: from docker import __version__ [as 别名]
def generate_user_agent():
parts = [
"docker-compose/{}".format(compose.__version__),
"docker-py/{}".format(docker.__version__),
]
try:
p_system = platform.system()
p_release = platform.release()
except IOError:
pass
else:
parts.append("{}/{}".format(p_system, p_release))
return " ".join(parts)
示例3: __init__
# 需要导入模块: import docker [as 别名]
# 或者: from docker import __version__ [as 别名]
def __init__(self, docker_url=None):
self.docker_url = docker_url or DockerPlugin.DEFAULT_BASE_URL
self.timeout = DockerPlugin.DEFAULT_DOCKER_TIMEOUT
self.capture = False
self.stats = {}
self.stream = False
s_version = re.match('([\d.]+)', docker.__version__)
version = tuple([int(x) for x in s_version.group(1).split('.')])
if version >= STREAM_DOCKER_PY_VERSION:
self.stream = True
collectd.info('Docker stats use stream')
示例4: docker_client
# 需要导入模块: import docker [as 别名]
# 或者: from docker import __version__ [as 别名]
def docker_client():
global _docker
if _docker is None:
params = docker_utils.kwargs_from_env()
params['version'] = 'auto'
if LooseVersion(docker.__version__) < LooseVersion('2.0.0'):
_docker = docker.client.Client(**params)
else:
_docker = docker.api.client.APIClient(**params)
return _docker
示例5: get_docker_client_requirement
# 需要导入模块: import docker [as 别名]
# 或者: from docker import __version__ [as 别名]
def get_docker_client_requirement():
DOCKER_PY_REQUIREMENT = 'docker-py >= 1.8.1, < 2'
DOCKER_RRQUIREMENT = 'docker >= 2.0.0, < 3'
docker_client_installed = True
try:
import docker
except ImportError:
docker_client_installed = False
if docker_client_installed and\
LooseVersion(docker.__version__) < LooseVersion('2.0.0'):
return DOCKER_PY_REQUIREMENT
return DOCKER_RRQUIREMENT