# Docker pull with sudo inline works but sudo enabled at the top of the ansible playbook fails

**URL:** <https://forum.ansible.com/t/docker-pull-with-sudo-inline-works-but-sudo-enabled-at-the-top-of-the-ansible-playbook-fails/17317>\
**Category:** Ansible Project\
**Created:** [January 20, 2015, 12:40am UTC](https://forum.ansible.com/t/docker-pull-with-sudo-inline-works-but-sudo-enabled-at-the-top-of-the-ansible-playbook-fails/17317 "2015-01-20T00:40:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_Wolcott](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@Kenneth\_Wolcott](https://forum.ansible.com/u/Kenneth_Wolcott)\
**Post date:** [January 20, 2015, 12:40am UTC](https://forum.ansible.com/t/docker-pull-with-sudo-inline-works-but-sudo-enabled-at-the-top-of-the-ansible-playbook-fails/17317/1 "2015-01-20T00:40:39Z")

</div>

Hello there;

&nbsp;&nbsp;Has anybody experienced a problem with "docker pull" as the action  
of an ansible playbook when sudo is enabled at the top of the ansible  
playbook, but the failure goes away when the action is replaced by  
"sudo docker pull"?

&nbsp;&nbsp;All my other docker actions work fine with sudo enabled at the top  
of the ansible playbook.

ansible 1.8.2 on Mac via homebrew

Thanks,  
Ken Wolcott

---

<div class="post-metadata">

**Author:** ![Kenneth\_Wolcott](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@Kenneth\_Wolcott](https://forum.ansible.com/u/Kenneth_Wolcott)\
**Post date:** [January 20, 2015, 1:28am UTC](https://forum.ansible.com/t/docker-pull-with-sudo-inline-works-but-sudo-enabled-at-the-top-of-the-ansible-playbook-fails/17317/2 "2015-01-20T01:28:27Z")

</div>

Hello again;

&nbsp;&nbsp;I tried an experiment where I added the one and only account on the  
vm in question to be a member of the docker group. Apparently, a  
member of the docker group cannot perform a docker pull, but only sudo  
docker pull.

&nbsp;&nbsp;&nbsp;Hmmm. I will try experimenting again with the docker Ansible module  
and see if I weirdness here as well.

Thanks,  
Ken Wolcott

---

<div class="post-metadata">

**Author:** ![Kenneth\_Wolcott](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@Kenneth\_Wolcott](https://forum.ansible.com/u/Kenneth_Wolcott)\
**Post date:** [January 20, 2015, 1:32am UTC](https://forum.ansible.com/t/docker-pull-with-sudo-inline-works-but-sudo-enabled-at-the-top-of-the-ansible-playbook-fails/17317/3 "2015-01-20T01:32:56Z")

</div>

I guess monologues are boring to others, but here goes with more info...

Doing a docker pull of a public docker image works fine without sudo  
if the user is a member of the docker group, but apparently if sudo  
was required previously to perform a docker pull, it will always be  
required (at least for private images) on DockerHub?

I'd sure like someone to explain this to me.

Thanks,  
Ken Wolcott
