Docker issues

Hello,

I’m running into issues with the docker module on ansible 1.7.2 (I also tried to 1.8). I’m trying to use docker on a VM I have provisioned in EC2. The relevant part of my playbook looks like this:

  • hosts: daas_daas_management
    user: ec2-user
    sudo: yes
    tasks:

  • name: Install docker
    yum: name=docker state=latest

  • name: Install docker python
    command: easy_install pip

  • command: pip install docker-py

  • name: Start the docker service
    service: name=docker state=started

  • name: Login to docker
    command: docker login --email=“xxxxx” --username=“xxxxx” --password=“xxxxx”

  • name: Start the mongo service
    docker: image=mongo ports=27017:27017 name=db state=restarted

Without pip messing about I get errors related to docker.client. With these present the error I get is this:

TASK: [Start the mongo service] ***********************************************

failed: [54.172.106.43] => {“failed”: true, “parsed”: false}

SUDO-SUCCESS-ifunupbpiebrbehdtnzjnxkysxohzizh

Traceback (most recent call last):

File “/home/ec2-user/.ansible/tmp/ansible-tmp-1412601522.36-141448805312079/docker”, line 342, in

from docker.client import APIError as DockerAPIError

File “/usr/lib/python2.6/site-packages/docker/init.py”, line 20, in

from .client import Client # flake8: noqa

File “/usr/lib/python2.6/site-packages/docker/client.py”, line 30, in

from . import errors

ImportError: cannot import name errors

So everything works well until I want to try docker commands. I don’t really want to run the commands locally, although I suppose that is an option if all else fails.

Can anyone help?

Thanks

andy

I resolved this in case anyone is interested. It’s a bug in docker-py (and possibly a conflict with the Amazon AMI) whereby the python six module needs to be upgraded for things to work.

andy

Hi Andy,

Can you give me a bit more details on how this was done?