Python源码示例:docker.__version__()

示例1
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
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
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
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
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