title: Ansible Shell Cannot Pull Docker Image
body: <p>I've run into issues pulling Docker images from a private DockerHub repo using the Docker module of Ansible, so to sanity-check that code decided to try pulling the image in question first using the shell. This also fails. What's going on here? If I SSH onto the box, I am able to run <em>exactly the same command</em> in the shell and it works, pulling the right image.</p>
  
  <p>Isolated example play:</p>
  
  <pre><code>---
  - hosts: &lt;host-ip&gt;
    gather_facts: True
    remote_user: ubuntu
    sudo: yes
  
    tasks:
    - include_vars: vars/client_vars.yml
    - name: Pull stardog docker image [private]
      shell: sudo docker pull {{stardog_docker_repo}}
  
    - name: Tag stardog docker image [private]
      shell: sudo docker tag {{stardog_docker_repo}} stardog_tag
  </code></pre>
  
  <p>The error that's being output is:</p>
  
  <pre><code>failed: [&lt;host-ip&gt;] =&gt; {"changed": true, "cmd": "sudo docker pull &lt;org&gt;/&lt;image&gt;:latest", "delta": "0:00:01.395931", "end": "2015-08-05 17:35:22.480811", "rc": 1, "start": "2015-08-05 17:35:21.084880", "warnings": []}
  stderr: Error: image &lt;org&gt;/&lt;image&gt;:latest not found
  stdout: Pulling repository &lt;org&gt;/&lt;image&gt;
  
  FATAL: all hosts have already failed -- aborting
  </code></pre>
  
  <p>NB: I've sanitised my <code>&lt;org&gt;</code> and <code>&lt;image&gt;</code> but rest assured their image identifier in the playbook and error logging perfectly match the image that I can successfully run in the shell over ssh by doing:</p>
  
  <pre><code>$ sudo docker pull &lt;org&gt;/&lt;image&gt;:latest
  </code></pre>
  
  <p>I'm aware of various GitHub issues (<a href="https://github.com/ansible/ansible-modules-core/issues/940" rel="nofollow">like this one</a> I had when using the Docker module), patches et cetera related to the <code>docker-py</code> library, but the thing here is I'm just using the Ansible <code>shell</code> module. What have I missed?</p>