Just a quick note that the Python module docker-py has been deprecated in favor of docker. I run a few Ansible hosts that run Docker containers for various reasons and recently they started to fail during their Ansible runs. Turns out that docker-py now fails during said runs. After some searching I found that this module hasn’t been updated in a very long time, and has been deprecated in favor of the docker module instead. I wrote the following small Ansible task to fix this on my machines.

---
  - name: remove depreciated docker-py module from pip
    pip:
      name: docker-py
      state: absent

  - name: Install docker python module with pip
    pip:
      name: docker

Obviously if you only have a machine or two you could also just pip install docker and pip uninstall docker-py.