本文整理匯總了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