docker-py 2.1.0 looks broken with docker 1.13.1 which breaks Kolla stable/ocata

Bug #1668346 reported by kbaegis
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Won't Fix
Jeffrey Zhang

Bug Description

All-in-one deployment fails kolla-ansible prechecks/deploy with Docker 1.13.1 and docker-py 2.1.0. Client connection string for docker-py not populated by the current code. Rolling back to docker 1.12.3 does not fix the issue. This is on a Gentoo system. This appears to work on Ubuntu Xenial.

TASK [elasticsearch : Get container facts] *************************************
task path: /usr/share/kolla-ansible/ansible/roles/elasticsearch/tasks/precheck.yml:2
Using module file /usr/share/kolla-ansible/ansible/library/
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1488213344.3-26926545306312 `" && echo ansible-tmp-1488213344.3-26926545306312="` echo ~/.ansible/tmp/ansible-tmp-1488213344.3-26926545306312 `" ) && sleep 0'
<localhost> PUT /tmp/tmpLq2z3_ TO /root/.ansible/tmp/ansible-tmp-1488213344.3-26926545306312/
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1488213344.3-26926545306312/ /root/.ansible/tmp/ansible-tmp-1488213344.3-26926545306312/ && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1488213344.3-26926545306312/; rm -rf "/root/.ansible/tmp/ansible-tmp-1488213344.3-26926545306312/" > /dev/null 2>&1 && sleep 0'
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_6wiJbY/", line 82, in <module>
  File "/tmp/ansible_6wiJbY/", line 64, in main
    client = docker.Client(version=module.params.get('api_version'))
AttributeError: 'module' object has no attribute 'Client'

fatal: [localhost]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_name": "kolla_container_facts"
    "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_6wiJbY/\", line 82, in <module>\n main()\n File \"/tmp/ansible_6wiJbY/\", line 64, in main\n client = docker.Client(version=module.params.get('api_version'))\nAttributeError: 'module' object has no attribute 'Client'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE"

Defective code (ansible/library/

import docker

def main():
    argument_spec = dict(
        name=dict(required=False, type='list', default=[]),
        api_version=dict(required=False, type='str', default='auto')

    module = AnsibleModule(argument_spec=argument_spec)

    results = dict(changed=False, _containers=[])
    client = docker.Client(version=module.params.get('api_version'))
    containers = client.containers()
    names = module.params.get('name')
    if names and not isinstance(names, list):
        names = [names]
    for container in containers:
        for container_name in container['Names']:
            # remove '/' prefix character
            container_name = container_name[1:]
            if names and container_name not in names:
            results[container_name] = container

kbaegis (kbaegis)
description: updated
Revision history for this message
Eduardo Gonzalez (egonzalez90) wrote :

The issue here is docker-py version is not backwards compatible and replaced docker.Client to docker.APIclient.

This is a breaking change to supported distros (ubuntu,centos,rhel,debian,oracle linux) since they does not have docker-py => 2.0.0 and in pip repositories

Could not find a version that satisfies the requirement docker-py==2.1.0 (from versions: 0.0.4, 0.0.5, 0.0.6, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.3.0, 0.3.1, 0.3.2, 0.4.0, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.6.0, 0.7.0, 0.7.1, 0.7.2, 1.0.0, 1.1.0, 1.2.1, 1.2.2, 1.2.3rc1, 1.2.3, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.6.0, 1.7.0rc1, 1.7.0rc2, 1.7.0rc3, 1.7.0, 1.7.1, 1.7.2, 1.8.0rc2, 1.8.0rc4, 1.8.0rc5, 1.8.0, 1.8.1, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6)
No matching distribution found for docker-py==2.1.0

This is a change that we'll have to do in the future but not now as it will break supported distributions.

Revision history for this message
Steven Dake (sdake) wrote :

Is it possible to work around this problem by detecting if docker.client is present and if not, use docker.APIclient? I spoke with the requirements team and they seemed to indicate that a top pin wasn't viable:

(eavesdrop didn't catch up with the conversation, however, its a little below the above link - search for sdake).

Changed in kolla:
status: New → Confirmed
importance: Undecided → Critical
milestone: none → ocata-rc2
Revision history for this message
Jeffrey Zhang (jeffrey4l) wrote :

check this

The name of the pip package is now docker (was: docker-py). New
versions of this library will only be published as docker from now on.

i do not think this matter. if we want to use the latest docker-py ( i.e. >=2.0 ), we need install through `pip install docker`. it is different packages.

Changed in kolla:
milestone: ocata-rc2 → 4.0.1
Changed in kolla:
milestone: 4.0.1 → 4.0.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/kolla-ansible

This issue was fixed in the openstack/kolla-ansible development milestone.

Changed in kolla:
milestone: 4.0.2 → 4.0.3
Revision history for this message
Jeffrey Zhang (jeffrey4l) wrote :
Changed in kolla:
assignee: nobody → Jeffrey Zhang (jeffrey4l)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/kolla-ansible 4.0.3

This issue was fixed in the openstack/kolla-ansible 4.0.3 release.

Changed in kolla:
milestone: 4.0.3 → 4.0.4
Revision history for this message
Jeffrey Zhang (jeffrey4l) wrote :

recently, i found docker ( python packages ) is not compatible with docker-py. so we won't fix this on ocata branch.

Changed in kolla:
status: In Progress → Won't Fix
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] contrail/ocata

Review in progress for
Submitter: Ramprakash R (<email address hidden>)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.