# Beginning Adventures with Docker Module

**URL:** <https://forum.ansible.com/t/beginning-adventures-with-docker-module/22662>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 28, 2016, 2:00am UTC](https://forum.ansible.com/t/beginning-adventures-with-docker-module/22662 "2016-09-28T02:00:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joaquin\_Menchaca](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Joaquin\_Menchaca](https://forum.ansible.com/u/Joaquin_Menchaca)\
**Post date:** [September 28, 2016, 2:00am UTC](https://forum.ansible.com/t/beginning-adventures-with-docker-module/22662/1 "2016-09-28T02:00:26Z")

</div>

I created a [vagrant environment](https://bitbucket.org/jmenchaca/ansible-exp/) to rapidly test code, and a custom inventory.py. But alas, **hosts: dockerexp.dev** doesn’t work, so screw it, **hosts: all**.

Now I have functional environment, time to do some docker stuff, try a simple **docker\_login:** and find that it doesn’t work. What’s this docker-py thingy? I have docker-py on my host development system. From Ansible’s marketing, I get that Ansible doesn’t require any agent, it’s simple, all that. So, I am accustom that is a push tech. Research later, find many others confused, find Ansible ticket, and most to their horror or chagrin, docker-py needs to be installed on the server. WHAT?!?!? confused.

- [http://stackoverflow.com/questions/38181433/ansible-cannot-import-docker-py-even-though-it-is-installed](http://stackoverflow.com/questions/38181433/ansible-cannot-import-docker-py-even-though-it-is-installed)
- [https://github.com/ansible/ansible-modules-core/issues/4246](https://github.com/ansible/ansible-modules-core/issues/4246)

Alright, install pip on Ubuntu… WTF 26 package dependencies… No way… **easy\_install pip** , **pip install docker-py**.

Good to go, back to docker fun, **ansible-playbook** …

WTF… Minimum version is 1.7.0, which is greater than 1.10.0? or something, WTF… google, google, google.

- Issue: [https://github.com/ansible/ansible-modules-core/issues/4047](https://github.com/ansible/ansible-modules-core/issues/4047)
- PR: [https://github.com/ansible/ansible-modules-core/pull/4048/commits](https://github.com/ansible/ansible-modules-core/pull/4048/commits)  
Apparently, there’s been a bug there for a while, maybe it only showed up at 1.10.0. Installed 1.7.0, works. Installed 1.9.0, works.

Finally, now I can do docker… **ansible-playbook** … FAIL… Aaaaaah… but this time, it’s my fault… fixed.

Ultimately, came up with these tasks for anywhere you want to use docker module, at least on Ubuntu:

```auto
  - name: Install easy_install
    apt: name=python-setuptools update_cache=yes
  - name: Install pip
    easy_install: name=pip state=latest
  - name: Install docker-py
    pip: name=docker-py version=1.9.0

```
