Python docker.__version__() Examples

The following are 5 code examples of docker.__version__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module docker , or try the search function .
Example #1
Source File: utils.py    From deepWordBug with Apache License 2.0 6 votes vote down vote up
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)) 
Example #2
Source File: utils.py    From deepWordBug with Apache License 2.0 5 votes vote down vote up
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) 
Example #3
Source File: dockerplugin.py    From docker-collectd-plugin with GNU General Public License v2.0 5 votes vote down vote up
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') 
Example #4
Source File: utils.py    From docker-make with Apache License 2.0 5 votes vote down vote up
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 
Example #5
Source File: setup.py    From docker-make with Apache License 2.0 5 votes vote down vote up
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